Hi all,
I'm trying to use JQuery to dynamically change a cobalt select field.
This is the HTML code for select box generated by cobalt ...
<select name="jform[fields][21]" class="elements-list cobalt-chosen-21"
id="form_field_list_21" style="max-width: 450px" aria-invalid="false">
<option value="">Select</option>
<option value="1501">1501</option>
<option value="1502">1502</option>
<option value="1503">1503</option>
</select>
And here is my attempt to clear and then add data ...
$('#form_field_list_21').empty();
$('#form_field_list_21').append($('<option>', {
value: 0,
text: 'Please Select'
}));
I keep getting the error "Uncaught TypeError: Cannot read property 'empty' of null".
I have got this working outside of cobalt with plain HTML files, but I'm not quite sure why it's not working in a cobalt template.
Would it be an out of date jquery include? I see "/media/jui/js/jquery.min.js" at the top of the file.
Thanks in advance,
Dale.
Hi all,
I'm trying to use JQuery to dynamically change a cobalt select field.
This is the HTML code for select box generated by cobalt ...
And here is my attempt to clear and then add data ...
I keep getting the error "Uncaught TypeError: Cannot read property 'empty' of null".
I have got this working outside of cobalt with plain HTML files, but I'm not quite sure why it's not working in a cobalt template.
Would it be an out of date jquery include? I see "/media/jui/js/jquery.min.js" at the top of the file.
Thanks in advance,
Dale.