Using jQuery you can do many things easily but sometimes you may not need to use jQuery for a small Application.
Okay then without using jQuery how can I get the text from a DIV tag?.
Its very simple you can get the text from a DIV tag using Javascript without using any library like jQuery etc.,
Here is the code:
document.getElementById('superman').innerHTML;
You may try yourself to get the text from a DIV tag using ‘.value’ but actually you should use ‘.innerHTML’
Here is an example:
<html> <head> <script type="text/javascript"> function test() { var t = document.getElementById('superman').innerHTML; alert(t); } </script> </head> <body> <input type="button" value="show text" onclick="test()" /> <div id="superman">This is the text from a div</div> </body> </html>
I hope this would have helped you in a critical situation.