jquery - Set the value of an input field? -
i have this:
<body> <header></header> <h1>request group rate</h1> <form> <input type="hidden" id="referrer"> //... </form> <script> $(document).ready(function(){ $('input[id="referrer"]').val(document.referrer); }); </script>
how set value attribute of <input>
id="referrer"
?
$(document).ready(function() { $("input[id=referrer]").attr('value', document.referrer); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <body> <h1>request group rate</h1> <form> <input type="text" id="referrer" value="" style="width:100%"> </form> </body>
Comments
Post a Comment