I'm trying to select first <option> from dropdown using jQuery.
In this case absolutely nothing changes:
In this case, the classes "active" and "selected" were added and cleared at once.
And <option> wasn't selected.
In this case absolutely nothing changes:
$("#select_id input:radio:first").attr('checked', true);
In this case, the classes "active" and "selected" were added and cleared at once.
And <option> wasn't selected.
$('div.item:nth-child(1)').addClass("active selected");
jQuery('dropdownselector').val(val).change();
jQuery('dropdownselector').closest('dropdown').dropdown('refresh');
jQuery('dropdownselector').closest('dropdown').dropdown('refresh');
I've used it already, but without success.
I'll try to describe my situation:
- I have a radios group and dropdown list (is hidden)

- default list is empty

- when you select the radio button, show the dropdown list tablesize

- in this code:
1) clear the dropdown list
2) append <option> from array
3) set value to dropdown
4) try to refresh dropdown
In result, value was set to dropdown. But still no selected.
If I comment //$ ("# tablesize"). Empty(); then the dropdown list will be selected after selecting the radios group twice (for example first radio button and second).
I'll try to describe my situation:
- I have a radios group and dropdown list (is hidden)

- default list is empty

- when you select the radio button, show the dropdown list tablesize

- in this code:
1) clear the dropdown list
2) append <option> from array
3) set value to dropdown
4) try to refresh dropdown
var table_size_article_1 = { "a_50×23": 374, "a_60×27": 527, "a_70×32": 728 };
$('input[name=tableview]').on("change", function() {
$("#tablesize").empty();
$.each(table_size_article_1, function(name, values){
$('#tablesize').append($('<option>', {
value: values,
text: name
}));
});
$("#tablesize").val(values).change();
$("#tablesize").closest('dropdown').dropdown('refresh');
});
In result, value was set to dropdown. But still no selected.
If I comment //$ ("# tablesize"). Empty(); then the dropdown list will be selected after selecting the radios group twice (for example first radio button and second).
Here's what I noticed:
- the hidden <select> has an active <option>
- and <div> class "text" is empty

Somebody know, how I can refresh data in <div class="text"> ?
- the hidden <select> has an active <option>
- and <div> class "text" is empty

Somebody know, how I can refresh data in <div class="text"> ?
Hi thebatik,
Please check the Dynamic Loading section on page 37 of the CFv6 manual - I think that this will do what you need here.
Bob
Please check the Dynamic Loading section on page 37 of the CFv6 manual - I think that this will do what you need here.
Bob
Hi Bob!
Please see to my picture (sorry, but i'm not a designer)

I see that original <select> working correct after method "append" only and I needn't to "refresh" function.
My js code contains in js file and checkbox "Add inside" is unchecked. Right?
Please see to my picture (sorry, but i'm not a designer)

I see that original <select> working correct after method "append" only and I needn't to "refresh" function.
My js code contains in js file and checkbox "Add inside" is unchecked. Right?

This topic is locked and no more replies can be posted.