I am new to javascript and have a very basic question:
I have this in my HTML
Total Cost: <input type="text" name="total" id="total" class="MyInput" />
I want to assign a value to this textbox at the program startup, for that I am using document.ready
, but its not working.
<SCRIPT LANGUAGE="JavaScript">
$(document).ready(function() {{
$("#total").value = "2";
});
What is the correct way of doing this?
Do:
$(document).ready(function(){ $("#total").val('2'); });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With