Computer Magic Logo
Class name selector

Thursday, January 12, 2017

Published by Aristotelis Pitaridis

The following example demonstrates how to select all elements which have the myClass class name.

var elements = $('.myClass');

We can also fine all the elements by tag name which have a specific class name. The following example selects all the <a> elements which have the class name myClass.

var elements = $('a.myClass');