JQuery – , JavaScript, HTML . , , CSS. jQuery .
CSS jQuery
, jQuery CSS, «».
- -, jQuery , DOM, . . , , hover, - first-line.
- -, jQuery , CSS, , CSS, .
, . CSS:
| |
| $("*") | |
$("b") | HTML, - <b>...</b> |
| $(".classA") | (<div class="classA">) |
| $("#IDone") | id (<div id="IDone">) |
CSS, jQuery . . , jquery ID - $("#IDone, b"). +, +ID, , $("b.classA").
CMS, , HTML- Id . , . , , jquery.
| |
| $("div[attribute]") | , |
| $("div[attribute='value']") | , |
| $("div[attribute!='value']") | , . , |
| $("div[attribute^='value']") | , , value |
| $("div[attribute$='value']") | , , value |
| $("div[attribute*='value']") | , value |
| $("div[attribute~='value']") | , value ( ) |
| $("div[attribute|='value']") | , value , |
, , , $("img[width=500][height=260]").
HTML- - jQuery. , , , jquery , (<p></p>).
| | |
| :contains() | $("p:contains('value')") – <p>, 'value'. | , . , . , , "text" "TEXT" |
| :has() | $("p:has(b)") – <p>, <b>. | , , . |
| :parent | $("p:parent") – <p>, -. | , - |
| :empty | $("p:empty") – <p>. | , . |
.
jquery , , $("p.mail:contains('e-mail')") "mail", "e-mail".
CSS. , DOM. jquery .
| |
| $("ul > li") | <li>, () <ul> |
| $("ul a") | <a>, <ul> |
| $("h1 + p") | <p>, <h1> |
| $("li ~ a") | <a>, <li>, , |
| $("li:first-child") | <li>, , , <ul> |
| $("li:last-child") | <li>, , , <ul> |
| $("li:nth-child(3)") | <li>, . , , |
| $("li:only-child") | <li>, () |
jquery li:nth-child(n), . , n even, , odd. n , , $("li:nth-child(2n+3)") , .
input , type. jQuery .
| | |
| :button | $("input:button") | |
| :checkbox | $("input:checkbox") | |
| :file | $("input:file") | |
| :image | $("input:image") | |
| :password | $("input:password") | |
| :radio | $("input:radio") | - |
| :reset | $("input:reset") | |
| :submit | $("input:submit") | |
| :text | $("input:text") | |
| :input | $(":input") | |
| :checked | $("input:checked") | - |
| :selected | $("option:selected") | option |
| :disabled | $("input:disabled") | |
| :enabled | $("input:enabled") | |
JQuery . .
| |
| :first | |
| :last | |
| :eq(n) | (n). ! , jQuery select 0! |
| :lt() | , n |
| :gt() | , n |
| :even | |
| :odd | |
- , . , : not(), , "" , .
: hidden, - 00 , , .
| |
| :not() | , |
| :animated | , jQuery |
| :hidden | display: none, type="hidden", 0px. , . ! visibility, "hidden", jquery select |
| :visible | : hidden |
| :header | h1, h2, h3, h4, h5 h6 |
?
- , , , . jQuery JavaScript , . , .
- jQuery.
- , . , .
- , , - .
An example script with jQuery and its selectors:
Conclusion
Now you know absolutely all selectors from jQuery, in addition, we hope that the examples helped you understand how to build the desired condition from several different selectors.