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 […]
Traversing through filtering
Traversing through filtering Finding element by filtering has following methods : METHOD DESCRIPTION EXAMPLE . eq() Find Elements by index $(“li”).eq(2).addClass(“drop”); .filter() The filter( selector ) method can be used to filter out all elements from the set of matched elements that do not match the specified selector(s). $(“li”).filter(“.middle”).addClass(“drop”); .first() Reduce the set of matched […]
Form Element Selector
: button Selector This type of selector is used to select all input buttons plus all button elements. Example : $(“:button”).css({background:”yellow”, border:”3px red solid”}); It changes the color and border of all buttons. : checkbox Selector It selects all the element of type checkbox. Example : $(“form input: checkbox”).wrap(‘‘).parent().css({background:”yellow”, border:”3px red solid”}); It select all […]
« go back — keep looking »