Q:

How to Set the Value of Input Text Box using jQuery

0

How to Set the Value of Input Text Box using jQuery

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Use the jQuery val() Method

You can simply use the jQuery val() method to set the value of an input text box.

Try out the following example to see how it actually works:

<!DOCTYPE html>
<html lang="en">
<head>
<title>jQuery Set Value of Input Text Box</title>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script>
$(document).ready(function(){
    $("#myInput").val("https://");
});
</script>
</head>
<body>
    <label>Enter Website URL:</label>
    <input type="text" id="myInput">
</body>
</html>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

JavaScript / jQuery Frequently Asked Questions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to Change the Text of a Button using jQuery... >>
<< How to Change CSS display Property to none or bloc...