Text
$("span").text()
Basically you can use this function for fetching text from a DOM element.
Html
We can use this function in two way.
While to take content from DOM element ,you can use it.
$("p").html()
Next one is that if you want to set content to DOM element, use in this way
$("p").html("Hello")
Here we are setting this string to p element
Val
$("input").val()
This method is used to take value from input element.
Attr
We can use this method to sets or get attributes of selected element.
To get attribute value, use this method.
$("a").attr("href")
To set attribute, use this method.
$("a").attr("href","http://datainflow.com")
Append
If you want to add some element at the end of the selected element then you can use this.
$("p").append("<span>DataInFlow</span>");
Prepend
Add content at the beginning of all elements.
$("p").prepend("<span>DataInflow</span>");
After
Insert content after each element.
$("p").after("<span>DataInflow</span>");
Before
Insert content before each element.
$("p").before("<span>DataInflow</span>");
Remove
This function is used to remove an element.Here I am removing div.
$("div").remove()
Empty
$("div").empty();
AddClass
addClass() method is used to add a class to an element.
$("p").addClass("red");
RemoveClass
removeClass() method is used to remove class from an element.
$("p").removeClass("red");
Css
This css() method is used to add style to an element.
$("button").css("color","red");
Width
width() method is used to get width of an element.
$("div").width();
Height
height() method is used to get height of an element.
$("div").height();