Memory

jQuery - Get Content & Attributes

jQuery contains powerful method for changing and manipulating HTML elements & attributes jQuery DOM Manipulation One of the important part of jQuery manipulate the DOM. We used \"getElementById()\" for accessing and ...

J
Joynal Abedin
6
jQuery - Get Content & Attributes

jQuery contains powerful method for changing and manipulating HTML elements & attributes

jQuery DOM Manipulation

One of the important part of jQuery manipulate the DOM.

We used \"getElementById()\" for accessing and finding the html element and also we used \"innerHTML\" for manipulate , replacing or getting the contents element.

This the first page

Output: Starting new page

Get Content - text(), html() and val()

This three element used for manipulate DOM:

text()This text return text and set values selected elements
html()This html return html and set values selected elements
val()This valu return value and set values form fields

This is the first page text





The following example demonstrates how to get the value of an input field with the jQuery val() method:

$(\"#btn1\").click(function(){
  alert(\"Value: \" + $(\"#test\").val());
});

J

Written by Joynal Abedin

Passionate about technology, code, and sharing knowledge.

0 Comments

Leave a Comment