I have a Multi Select dropdown, from where users selects multiple items.
On the basis of option values selection, dynamic Textbox should generate in the same form.
On selecting single option, 3 textbox should generate.
1st textbox showing values of the selected option
2nd textbox showing text of the selected option
3rd textbox showing null.
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body align="center">
<input type="text" value="some text"/>
<select id="multiple" multiple="multiple" style="width: 120px;height: 120px;">
<option value="1" >Ashutosh</option>option value="6">Jems Bond</option>
<option value="7">Danial Crack</option> option value="8">Dan Brown</option>
<option value="9">Angilina Jolly</option>
</select>
<script>
function displayVals() {
var multipleValues = $("#multiple").val() || [];
$("input").val(multipleValues);
}
$("select").change(displayVals);displayVals();
</script>
</body>
</html>
Here i have made complete solution for your query. please check demo link as shown below:
Demo http://codebins.com/bin/4ldqp7a
HTML
JQUERY
CSS
Demo http://codebins.com/bin/4ldqp7a