① Relative positioning of jQuery elements.
In jQuery, you can not only use selectors for absolute positioning, but also relative positioning. As long as the second parameter is specified in $(), the second parameter is the relative element. The second parameter is passed a jQuery object, and relative selection is performed relative to this object.
A | |
333 | C |
555 | E |
666 | F |
777 | G td> |
888 | H | I |
Operation rendering:
②$("div[id]") selects the div with the id attribute
③$("div[title=test]") selects the div with the title attribute "test". Note: an equal sign.
$("div[title!=test]")Select a div whose title attribute is not "test"
④$("input:checked")Note : There is no space between input and :checked
⑤The difference between $("input") and $(":input")
$("input") can only be obtained tag, but
Prevent event bubblinge.stopPropagation();
Prevent default behavior: e.preventDefault() has the same effect as window.event.returnValue=false