Element ('element') JQ Home  <<  Selectors  <<  Element ('element')

Element selector.

Shorthand version $('element')


The ('element') selector, selects all elements that have the specified tag name.


Signature Description
jQuery('element')Element match


Parameter Description
element An element to search for (this refers to the tagName of DOM nodes).



Element ('element') Example Selectors  <<  Top

Selects all elements that have the specified tag name.

This method calls JavaScript's getElementsByTagName() function 'under the hood' to return the appropriate elements when used.

The following example will select all 'em' elements and change the text colour of these elements to green.

  $('#btn10').on('click', function() {
    $('em').css('color', 'green');

Press the button below to action the above code:

Related Tutorials

jQuery Basic Tutorials - Lesson 3 - CSS Selectors