javascript - MultiSelect Dropdwon list value Move To Text Box -
i using javascript code copying field value field. when use check box in dropdown, have click check box value copy text-box.
but selects single not multiple value in text box...
<script> $(document).ready(function() { $("#dropdown").on('change',function(){ var dropdownval=this.value; $("#textbox").val(dropdownval); }); }); </script> <form> <p> <select multiple="multiple" name="dropdown" id="dropdown" style="width:370px"> <option value="red">red</option> <option value="green">green</option> <option value="blue">blue</option> <option value="orange">orange</option> </select> </p> <input type="text" class="normal" id="textbox" name="textbox" style="width:450px;"></td> </form> <script type="text/javascript"> $("select").multiselect().multiselectfilter(); </script>
i using multiple select drop-down list check-box.
this.value;
should $(this).val();
if using jquery. , needed click
event instead of change
event. see working version: http://jsfiddle.net/5q552/1/
and info: instead of $(document).ready(function(){});
can use: $(function(){});
$(function() { $("#dropdown").on('click',function(){ var dropdownval=$(this).val(); $("#textbox").val(dropdownval); }); }); <form> <p> <select multiple="multiple" name="dropdown" id="dropdown" style="width:370px"> <option value="red">red</option> <option value="green">green</option> <option value="blue">blue</option> <option value="orange">orange</option> </select> </p> <input type="text" class="normal" id="textbox" name="textbox" style="width:450px;"></td> </form>
Comments
Post a Comment