php - change textbox value with javascript codeigniter -


my view javascript :

<html> <head> <script type="text/javascript">     document.getelementbyid("asd").value = 'sdasdsad'; </script> </head>  <body> $atta = array(     'id' => 'asd' ); echo form_input($atta); </body> </html> 

the result is, textbox empty. happened?

your did not enclosed php scripts php tags.

why not try this.

<html> <head> <script type="text/javascript">     window.onload=function() {        document.getelementbyid("asd").value = 'sdasdsad';     } </script> </head>  <body> <input type="text" id="asd" > </body> </html> 

Comments

Popular posts from this blog

javascript - three.js lot of meshes optimization -

smartface.io - Proper way to change color scheme for whole application -

Email notification in google apps script -