.Net Interview Questions and Answers

Search:

Explain important Jquery selectors? (Jquery Interview Questions)

By : Shiv Prasad Koirala | Jun 5th, 2014 | Views : 3407 | Comments : 0 Bookmark and Share

You can select HTML elements using Jquery in the following ways:-


Select all


Below is a simple code snippet which selects all elements and hides them.


$("*").hide();


Select by Element


Below code selects all paragraph element tags in the HTML and hides them.


$("p").hide();


Select by ID


If your HTML elements have id's like the below HTML code and you want to select the same by id.


<p id="p1">Some Para</p>


Below is how the Jquery code by ID selection code would look like.


$("#p1").hide();


Select by class


If your HTML element has class names and you want to select them in jquery using them you need use the dot followed by the classname as shown in the below code.


<p class="class1">Some Para</p>

 

$(".class1").hide()


Select by class and element


Consider the below HTML code where we have elements with "class" names.


<p class="c1">para 1</p>

<p class="c1">para 2</p>
<p class="c2">para 2</p>

<p class="c2">para 2</p>

 


So if you wish to select by "element" and "class" in Jquery your selector code becomes something as below.


$("p.c1").hide();


Below is youtube video created by questpond.com team who provide .NET Learning videos for interview preparation. The below video explains what is Jquery with simple example.


 
Rate this Article :
1 Star
2 Stars
3 Stars
4 Stars
5 Stars
1 1 1 2 1
 
 
 
 

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

.NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala

In this article we will explain .NET interview questions 6th edition (Sixth edition) - By Shivprasad Koirala.... Read More

Explain MVC application life cycle?

In this article we will explain MVC application life cycle.For more articles and videos visit us on www.questpond.com... Read More

What is the difference between Stored Procedures and Function (SQL Server interview question with answers)?

In this article we will explain what is the difference between Stored Procedures and Function.For more articles and videos visit us on www.questpond.com... Read More

C# Design pattern interview questions with answers: - How Singleton is different from Static class?

In this article we will explain How Singleton is different from Static class.... Read More

WCF interview questions and answers: - What is the difference between Service endpoint and Client endpoint?

In this article we will explain What is the difference between Service endpoint and Client endpoint.... Read More

Article Categories

Learn in Hindi