jsf 2 - Unable to replace div content with JavaScript in JSF -


i use javascript code below replace contents of div, it's not working.

<h:head>     <script type="text/javascript">         function findchange() {             document.getelementbyid("mydiv").innerhtml='ravi';         }     </script> </h:head> <h:body>     <h:form  id="form" onsubmit="findchange();">         <div id="mydiv">hello</div>         <h:commandbutton value="submit" ></h:commandbutton>     </h:form> </h:body> 

inspired @louisbros:

    <h:head>         <script>             function findchange(){                 document.getelementbyid('mydiv').innerhtml = 'ravi';                 return false;             }         </script>     </h:head>     <h:form onsubmit="return findchange();">         <div id="mydiv">hello</div>         <h:commandbutton value="test" />     </h:form> 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -