-
Notifications
You must be signed in to change notification settings - Fork 3
jQuery dropdownlist input field name
Maikel Bos edited this page Jul 18, 2019
·
1 revision
By default, jQuery-dropdownlist creates input fields with a name of dropdownlist-{random number}
. It is easy to set the name by using the data-field-name
attribute on the main element of your dropdown. The below example will generate hidden input fields with the name example-field-name
.
<div id="example-dropdown" data-field-name="example-field-name">
<div>Choice number 1</div>
<div>Option 1a</div>
<div>Second choice</div>
<div>Final option</div>
</div>
<script type="text/javascript">
$('#example-dropdown').dropdownlist();
</script>