Selectors in jquery start with $ sign followed by ()
Different type of selectors
1. Element selector- it selects elements based on elements name
For example $(“p”)
2. Id Selector– to select single element we will use this selector
Example- $(#myid)
3. Class selector- to select a element with specific class
Example-$(“.test”);
Below example will define all the selectors in a single function
1 2 3 4 5 6 7 8 9 10 |
$(document).ready(function() { $("button").click(function() { $("p").hide(); $(#myid).hide(); $(.test).hide(); )}; )}; |