Reputation: 183
can someone take a look at this please
http://jsfiddle.net/bloodygeese/ecscY/56/
it looks like I have got the 2 separate functions working but I need to get them to both work at the same time? So clicking on image1.image2,image3,image4 will change the drop down, but I also need to display the value of the drop down at the same time,
It seems I can only do this separately?
It would also be great if I could get the "label:"to display the 1st option as default. And i am going to have 16(maybe more) options in the drop down, is there any way the code can be simplified? rather than a function for each?
Upvotes: 0
Views: 1820
Reputation: 144689
try this:
$('#one, #two, #three, #four').click(function() {
$('#dropdown').val($(this).attr('id'));
$('#dropdown').trigger('change')
})
Upvotes: 1
Reputation: 79830
Call .change()
after calling .val()
. See below,
$('#dropdown').val($(this).attr('id')).change();
Upvotes: 0