- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to get innerHTML of a div tag using jQuery?
To get the innerHTML of a div tag in jQuery, use the class with innerHTML. You can try to run the following code to learn how to get innerHTML of a div tag using jQuery −
Example
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $("#button1").click(function(){ var one = $('.a').innerHTML; alert(one); }); }); </script> </head> <body> <div class="a">Value one</div> <button id="button1">Get</button> </body> </html>
- Related Articles
- How to replace innerHTML of a div tag using jQuery?
- How to replace innerHTML of a div using jQuery?
- How to get the width of a div element using jQuery?
- How to get the height of a div element using jQuery?
- How to find anchor tag in div and add class using jQuery?
- How to get the value of div content using jQuery?
- How to duplicate a div using jQuery?
- How to copy the content of a div into another div using jQuery?
- How to toggle a div visibility using jQuery?
- How to create div dynamically using jQuery?
- How to print div content using jQuery?
- How to load a page in div using jQuery?
- How to add a title in anchor tag using jQuery?
- How to add a class on click of anchor tag using jQuery?
- How to create navigation bar using div tag in HTML?

Advertisements