![]() ![]() ![]() ![]() Events – Just like we have JavaScript events, we can set up listeners with jQuery.Selector – Similar to how we target CSS elements in the style sheets, we use selectors.Learn how to include jQuery in your HTML code. Basics – Introduction to jQuery syntax through commonly used code examles.Click the code snippets to highlight then copy-paste them in your project! Hide the green comments with the link in the top right corner of the site. Find the most common code snippets on a single page. JQuery Cheat Sheet will help you create the code for animations, various effects and other features for your website. big class $( "div").not( ".big") // opposite of filter next() // the next sibling $( "p").nextAll() // all next siblings $( "#demo").nextUntil( "#demo2") // siblings between two arguments $( "#demo").prev() // the previous sibling $( "p").prevAll() // all previous siblings $( "#demo").prevUntil( "#demo2") // previous siblings between two arguments Filtering $( "span strong").first() // first strong in first span $( "span strong").last() // last strong in last span $( "div").eq( 9) // element with a specific index $( "div").filter( ".big") // all div elements with. find( "*") // all descendants $( "#demo").siblings( "span") // span siblings of #demo $( "#demo"). find( "span") // all span elements inside #demo $( "#demo"). parent().hide() // changing parent color $( "#demo").parents() // all ancestors of the element $( "#demo").parentsUntil( "#demo2") // all ancestors between two - demo is inside demo2 $( "#demo").children() // all direct children $( "#demo").children( ".first") // all direct children having a specified class $( "#demo"). parent() // accessing direct parent $( "span"). Width, height, innerWidth, innerHeight, outerWidth, outerHeight Hide / Show $( "#demo").hide() // sets to display: none $( "#demo").show( 200) // shows hidden elemnt with animation (speed) $( "#demo").toggle() // toggle between show and hide $( "#element" ).hide( "slow", function() ) // sets multiple CSS properties Dimensions $( "*") // all elements $( "p.demo") // elements with class="demo" $( "p:first") // the first element $( "p span") // span, descendant of p $( "p > span") // span, direct child of p $( "p + span") // span immediately proceeded by a p $( "p ~ span") // strong element proceeded by p $( "ul li:first") // the first element of the first $( "ul li:first-child") // the first element of every $( "ul li:nth-child(3)") // third child $( "") // any element with an href attribute $( "a") // elements with a target "_blank" attribute $( "a") // elements with a target attribute value other than "_blank" $( ":input") // all form elements $( ":button") // and elements of type="button" $( "tr:even") // even elements $( "tr:odd") // odd elements $( "span:parent") // element which has child element $( "span:contains('demo')") // element conaining the specified text Actions $(selector).action() $( this).hide() // the current element $( "div").hide() // all elements $( ".demo").hide() // all elements with class="demo" $( "#demo").hide() // the element with id="demo" ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |