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

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -