How can you select all elements in a page using jQuery?

 Posted by Akiii on 5/28/2011 | Category: jQuery Interview questions | Views: 6187 | Points: 40

To select all elements in a page, we can use all selectors, for that we need to use *(asterisk symbol).

<script language="javascript" type="text/javascript">

$("*").css("border", "2px dotted red");

The above code will select all elements of the web page and apply border width as 2 pixel, style as dotted and color as red.

Thanks and Regards

Source: | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response