jQuery event helpers
.live() This method attach a handler to the event for all elements which match the current selector, now or in the future. Example : Following code binds the click event to all paragraphs. And add a paragraph to another clicked paragraph : Click me! .die( ) This method removes the handler which is previously attached […]
jQuery working with CSS(CSS Manipulation)
.css( ) This method get the CSS style property of the first matched element.. Example : Above code display the color code of the clicked ‘div’ . .height( ) This method get the height of the first matched element. Example : $(“p”).height()); // returns height of paragraph. $(window).height(); // returns height of browser viewport $(document).height(); […]
jQuery inserting content(DOM Insertion)
.unwrap( ) The .unwrap() method removes the element’s parent from the matched set .It leaves the matched element at their place. Example : $(“p”).unwrap(); This script removes the parent of ‘p’. .wrap( wrappingElement ) This method wrap the html wrapping element around each of the matched elements. The ‘wrapedElement ‘ may be div, span etc. […]
jQuery manipulating attributes
Manipulating CSS class attribute You can manipulate CSS class attribute using following methods : .addClass() You can add any css class to filtered elements through this method. Example : Following code add selected css class to last paragraph : .hasClass() Using this method , you can check any of the matched elements have provided css […]
jQuery Tree traversal
.children() This method get a set of elements containing all of the unique immediate children of each of the matched set of elements. Example : $(“div”).children(“.selected”).css(“color”, “blue”); It finds all children with a class “selected” of each div. .closest( ) This method get a set of elements containing the closest parent element that matches the […]
« go back — keep looking »