Steve
Steve

Reputation: 4908

Selecting the same option twice in a row from a Select element

I have a jsfiddle here - http://jsfiddle.net/stevea/rBd5T/1/ - with a select element. In my application I load the file selected and display it on a canvas. I may want to load the same file several times in succession. ( It might be a button template, for example, and I want to load several and then modify each one.) But if I select the same file again, say "blue" from the drop down the list, it doesn't count as a "change" the second time and so the handler doesn't get called. How can I select "blue" twice in succession and get called each time?

I'd be happy if I could somehow automatically select the "LOAD" option after each selection so that any selection then was a change.

Thanks for any ideas.

$('#load_dropdown').change(function(event){
    console.log("load triggered");
});

Upvotes: 0

Views: 792

Answers (1)

Seano666
Seano666

Reputation: 2238

I'm with Rooster, make the first blank or something like ---select one---, then inside the event default it back to

dropdownmenu.selectedIndex = 0;

Upvotes: 1

Related Questions