jQuery Tutorial


jQuery Example


jQuery References


jQuery HTML Method References




jQuery HTML References

All jQuery HTML manipulation method are listed here. All jQuery HTML method work on some different purpose. which you have to binding with your program.

HTML Method Description
addClass()
Use Add one or more CSS class to selected elements.
Syntax $(selector).addClass(classname)
parameter classname is Required parameter. add one or more css class names.
Example $("p").addClass("param");
after()
Use after method add into end of selected elements.
Syntax $(selector).after(content)
parameter content is Required parameter. Insert after the content into selected element.
Example $("p").after(" Online Web Development Tutorial");
append()
Use Inserts content into inside end of the selected elements.
Syntax $(selector).append(content)
parameter content is Required parameter. Insert content end into selected element.
Example $("p").append("Online Web Development Tutorial");
attr()
Use Set attribute and value of selected elements.
Syntax $(selector).attr(attribute)
parameter attribute is Required parameter. get the value of attribute.
Example $("p").attr("align","center");
before()
Use before method add into start of selected elements.
Syntax $(selector).before(content)
parameter before is Required parameter. Insert before the content into selected element.
Example $("p").before(" Way2Tutorial ");
clone()
Use Copy of selected child elements.
Syntax $(selector).clone().childnode()
childnode childnode is Required parameter. include on childnode,text, attributes.
detach()
Use Remove the selected elements.
Syntax $(selector).detach()
Example $("#p2").detach();
empty()
Use Removes all child elements from selected elements.
Syntax $(selector).empty()
Example $("div").empty();
hasClass()
Use Checks for selected element is specify by Class.
Syntax $(selector).hasClass()
Example alert($("p").hasClass("param"));
html()
Use Sets or returns the contains of selected elements.
Syntax $(selector).html()
Example $("p").html("Congratulation, Way2Tutorial");
insertAfter()
Use Inserts HTML elements after selected elements.
Syntax $(content).insertAfter(selector)
parameter selector is Required parameter. Insert after in selected element.
Example $("<p> Way2Tutorial </p>").insertAfter("p");
insertBefore()
Use Inserts HTML elements before selected elements.
Syntax $(content).insertBefore(selector)
parameter selector is Required parameter. Insert before in selected element.
Example $("<p> Way2Tutorial </p>").insertBefore("p");
prepend()
Use Inserts content into inside beginning of the selected elements.
Syntax $(selector).prepend(content)
parameter content is Required parameter. Insert content inside first into selected element.
Example $("p").prepend("Online Web Development Tutorial");
remove()
Use Removes all selected element content like child elements or text.
Syntax $(selector).remove()
Example $("div").remove();
removeAttr()
Use Removes attributes from selected elements.
Syntax $(selector).removeAttr(attribute)
parameter attribute is Required parameter. Insert content inside first into selected element.
Example $("div").removeAttr("align");
removeClass()
Use Removes one or all class from selected elements.
Syntax $(selector).removeClass(classname)
parameter classname is Required parameter. remove one or all css class.
Example $("p").removeClass("param");
replaceAll()
Use Replace All selected elements with new contents.
Syntax $("content").replaceAll(selector)
parameter selector is Required parameter. content define replace all on selected elements.
Example $("<p>Web Development Tutorial</p>").replaceAll("p");
replaceWith()
Use Replace selected elements with new contents.
Syntax $("selector").replaceWith(content)
parameter content is Required parameter. content define replace on selected elements.
Example $("p").replaceWith("<p>Web Development Tutorial</p>");
text()
Use Sets the text content of selected elements.
Syntax $("selector").text(content)
parameter content is Required parameter. content text set on selected element.
Example $("p").text("Web Development Tutorial");
toggleClass()
Use Toggles add or remove one or more class from selected elements.
Syntax $(selector).toggleClass(classname)
parameter classname is Required parameter. add one or more css class names.
Example $("p").toggleClass("param");
wrap()
Use Wrap method around the HTML selected element.
Syntax $(selector).wrap(wrapelement)
parameter wrapelelement is Required parameter. html element like <div></div> etc.
Example $("p").wrap("<div></div>");
wrapAll()
Use WrapAll method around the all HTML selected element.
Syntax $(selector).wrapAll(wrapelement)
parameter Wrap element is Required parameter. html element like <div></div> etc.
Example $("p").wrapAll("<div><div>");
wrapInner()
Use WrapInner method around the content of each HTML selected element.
Syntax $(selector).wrapInner(wrapelement)
parameter Wrap element is Required parameter. html element like <div></div> etc.
Example $("p").wrapInner("<u><u>");