I'm using this script http://mondaybynoon.com/2009/02/23/creating-custom-form-elements-using-jquery-selects/ to create custom css select boxes in my page. Javascript code that is used to apply the css styles on selectboxes, uses their id as a parameter:
$(document).ready(function() {
$('#cont').selectbox({debug: true});
});
<select id="cont" name="cont" tabindex="1">
<option value="1">aaa</option>
<option value="2">bbb</option>
<option value="3">ccc</option>
</select>
Can I somehow use just the "name" attribute of select boxes and not the "id"??? Is this possible?
you can use the attribute selector to selct via name
e.g.
$('select[name="cont"]').selectbox({debug: true});
Sure, to base your selector off of the name-attribute, simply do the following:
$("[name='nameHere']");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With