On May 25, 1:29 am, "Rob Desbois" <[EMAIL PROTECTED]> wrote:
> Oh yes, sorry I forgot the ); after the function passed to $.each().
> Corrected (and tested!) version is below:
It seems to me that the only jQuery function necessary is .each,
subsequent use of $ is unnecessary.
If the intention is to select only one option (i.e. it is a single
select) then the function should exit once that occurs - the following
is a shorter version. I'm new to jQuery, can you show me how to get
out of the loop once the correct option is found?
function test() {
$("#smsUserPrice option").each(function() {
if ( this.value == "z" ) {
this.selected = true;
// stop .each loop here... how?
}
}
}
--
Rob