Do I need to "commit" a .val() change in Jquery? -


i've got function looks bit this:

$('#companydropdown').bind("change", function () {     $('#products').find('.productdropdown').each(function () {         setrates(this);     });     identifylowestrate(); }); 

basically we've got product rows, , columns each product, 1 of "rate". when company dropdown changes, products change, , rate column updated.

say need find lowest rate across products, whenever products shuffled.

setrates doing like:

$('#product1').val(foo); 

identifylowestrate doing (looping on products):

lowestrate = math.min(parsefloat(lowestrate), parsefloat($(this).val())); 

identifylowestrate looks again @ product loop , finds lowest rate. problem it's finding previous lowest rate as if setrates still not finished. in fact if set breakpoint or alert prior identifylowestrate can indeed see setrates changes haven't yet been committed our webpage.

is "thing" in jquery - have commit change in way before can retrieve value .val()?

passing value val() sets , "commits" right away. calling again retrieve latest value input.

http://api.jquery.com/val/


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -