jQuery – Get Content

To get the content from a web page using jQuery, we can use the text(), html() and val() methods. In this lesson, we will learn how to,

  • Get the Text of the selected element
  • Get Content from the Form Fields

Get the Text of the selected element

To get the text of the selected element in jQuery, use the text() and html() methods. Let us see an example wherein we will get the text of the <p> element with id demo:

Output

Get the Text of the selected element jQuery

Get Content from the Form Fields

To get the content from the Form fields, use the val() method in jQuery. Let us see another example wherein we will get the content from the form fields:

Output

Get content from form fields jQuery

jQuery - Find Siblings of an element
jQuery - Set Content
Studyopedia Editorial Staff
contact@studyopedia.com

We work to create programming tutorials for all.

No Comments

Post A Comment

Discover more from Studyopedia

Subscribe now to keep reading and get access to the full archive.

Continue reading