html - I am just trying to pass some javascript value from function func() to the tag "p".But it's not happening.Can anyone help me with this? -
a part of html body:
<div id="d">     <div class="imge">         <img src="meter.jpg" width="450" height="350" alt="" />         <h2>1234578  kwh</h2>     </div> </div>   this javascript function.
function func() {  document.getelementbyid("d").getelementsbyclassname("imge").getelementsbytagname("h2")[0].innerhtml="string" }   is above syntax correct?
thanks in advance
the code in func() should document.getelementbyid("d").getelementsbyclassname("imge")[0].getelementsbytagname("h2")[0].innerhtml="string"
as getelementsbyclassname returns array
Comments
Post a Comment