Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
frontend
html
examples
forms
04text_disabled_readonly_js.html
04text_disabled_readonly_js.html
<!DOCTYPE HTML> <html lang="hr"> <head> <meta charset="UTF-8"> <title>Readonly and disabled inpute text fields</title> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script> function ispis() { $(document).ready(function(){ var var_readonly=$('input[name="var_readonly"]').val(); var var_disabled=$('input[name="var_disabled"]').val(); console.log(var_readonly); $('p#val1').append(var_readonly); $('p#val2').append(var_disabled); }); } </script> </head> <body> Submit the form and see that <br><b>var_readonly</b> is passed to the PHP script but <br><b>var_ disabled</b> is not passed. <br> <br> <form action="javascript:ispis()" method="POST" enctype="application/x-www-form-urlencoded"> <label for="f1">var_readonly:</label> <input type="text" id="f1" name="var_readonly" value="val1" size="5" readonly> <br> <label for="f1">var_disabled:</label> <input type="text" id="f1" name="var_disabled" value="val2" size="8" disabled> <input type="submit" value="Send"> </form> <hr> Output variables: <p id="val1"><b>var_readonly:</b> </p> <p id="val2"><b>var_disabled:</b> </p> </body> </html>
Reload page
Preview
W3C validation
Edit Code