I have a select with multiple options and a form below with an empty text input. I want the text input to change whenever I change the select but still be updatable. Is it possible?
<select name="title" form="updating" onChange="document.getElementById('selectedValue').innerHTML = this.value;">
.....
<form action="update.php" id="updating">
Article Title:<br>
<input type="text" name="article_title" id=selectedValue>
<input type="submit" value="Submit">
</form>
I hope this is what you're looking for. With JQuery you can easily use the "on change" function.
$(document).ready(function() { $('#mySelect').change(function() { $('#myInput').val($(this).val()); }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <select id="mySelect"> <option value="Element 1">Element 1</option> <option value="Element 2">Element 2</option> <option value="Element 3">Element 3</option> </select> <br/> <input type="text" id="myInput" value="" />
If you need some more specific function please be more specific also with your question
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.