-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathselectorsjs.js
More file actions
11 lines (11 loc) · 861 Bytes
/
selectorsjs.js
File metadata and controls
11 lines (11 loc) · 861 Bytes
1
2
3
4
5
6
7
8
9
10
11
function change() {
// similar to getelemetbytagname
// $("div").css("background-color", "orange"); // it will change the color of all div elements background to orange.
// $("#div2").css("background-color", "orange"); // to chnage only particular div
// it will not work for similar ids jquery needs id to be unique but can be possible with class
// $("#div3,#div1").css("background-color", "green"); // to change multiple divs with diffrenet id
$("#div1,li,.para").css("background-color", "purple"); // we can also do this like one is id and other is class or tagname
// $("div li").fadeToggle(); // to access inside the element also("div >li")
// $("p:first").fadeToggle(); // it does not support furthur like second or third and it will acess the very first p tag in wole document
// $("li:odd").fadeToggle(); // can also work with even
}