Get content - text(), html() and val() Three simple and practical jQuery methods for DOM operations:
text() - Settings Or return the text content of the selected element
html() - Set or return the content of the selected element (including HTML tags)
val() - Set or return the value of the form field
Get attributes - attr() jQuery attr() method is used to get attribute values.
The following example demonstrates how to get the value of the href attribute in the link:
Example
$("button").click(function(){
alert($("#w3s").attr("href"));
});