Viper5646 Posted May 27, 2010 Share Posted May 27, 2010 Hi allI am currently learning HTML DOM in W3 Schools.I came across InnerHTML and decided to create a little code using innerHtml, But it doesn't seam to work.When I click the button nothing happens.Can someone give me some info where I went wrong.Thanks. !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head> <title>Title</title></head><body><script type="text/javascript">function newtext(){ var userinput = document.getElementById('userInput').value; document.getElementById('bolder').innerhtml = userInput;}</script><p>Welcome To The MY Site <b id='bolder'>DUDE</b></p><input type='text' id='userInput' value='type text here' /><input type='button' onclick='newtext()' value='change text' /></body></html> Link to comment Share on other sites More sharing options...
Ingolme Posted May 27, 2010 Share Posted May 27, 2010 Javascript is case sensitive. It means that innerhtml is different than innerHTML. Link to comment Share on other sites More sharing options...
Viper5646 Posted May 28, 2010 Author Share Posted May 28, 2010 Thanks Ingolme for your help.Now It's working. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.