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

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

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");
</script>


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
Akiii


Source: jquery.com | Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response