I was trying to make this small script where you can only use numbers once in a series of dropdown boxes so.. [1] [3] [2] [2] [3] [1] [2] [1] [3] all are fine but not [2] [2] [1] [1] [1] [3] ..
I think I have it half way done.
$("#left").focus(function () {
// Store the current value on focus, before it changes
previous = this.value;
}).change(function() {
// Do soomething with the previous value after the change
var num1 = $("#left option:selected").text();
if ( $("#middle option:selected").text() == num1){
$("#middle option:selected").text(previous)
}
if ( $("#right option:selected").text() == num1){
$("#right option:selected").text(previous)
}
});
Here is a link to the full thing: http://jsfiddle.net/U3WSz/
Its works for a little bit but I realized the drop down options started changing. If you play around with it enough, you'll notice what i'm seeing.
I also notice how I repeat a lot of code. Let me know if there's a better way to write it.
.text()does?