To ‘Get’ an element in jQuery

To ‘get’ and element ID or CLASS you can use the same functions as CSS i.e. $('#id-name'); or $('.class-name'); You can use single or double quotes too, i.e. $('#single-quotes'); or...

To ‘get’ and element ID or CLASS you can use the same functions as CSS i.e.

$('#id-name');

or

$('.class-name');

You can use single or double quotes too, i.e.

$('#single-quotes');

or

$("#double-quotes");

You can also drill down by leaving a gap between CSS names. i.e. If you had an ‘a’ tag in a div with an id of #myDiv, you could use:

$('#myDiv a');

No related posts.

This post has had 9 views