Joydip Panchal Javascript Tutorial
html - How to get div element values in javascript???
To get value from any Div element, first give it id and then access it by its id.
Example :
<html>
<head>
<script type='text/javascript'>
function showValue()
{
alert(document.getElementById('pText').innerHTML);
}
</script>
</head>
<body>
<p id='pText'>Help2engg</p>
<button onclick='showValue()'>Click Me</button>
</body>
</html>
To get value from any Div element, first give it id and then access it by its id.
Example :
<html>
<head>
<script type='text/javascript'>
function showValue()
{
alert(document.getElementById('pText').innerHTML);
}
</script>
</head>
<body>
<p id='pText'>Help2engg</p>
<button onclick='showValue()'>Click Me</button>
</body>
</html>
Admin and 2 other like this
Moni Kachhadiya