Hi,
How you get data.distance_type value ?
if you call data.distance_type inside JQuery function, be careful because data.distance_type means:
data -> div name or something like that
and
.distance_type -> that's a class selector !
So, together means a div name with class distance_type
If you don't use inside JQuery function, that name is allright.
So, you could write datadistance_type to avoid confusion, that's why JQuery see as a class selector if you write something with "dot" symbol inside JQuery function
look in my example : jsfiddle.net/HCSxg/
write "min" or "max" in input text and click outside input (everywhere in page) and you'll see an alert and select value will change
or
Code:
if(t=="min" || t=="max")
$("#distancetype").attr("value",t);
where distancetype is distance-type
and t is datadistance_type, NO data.distance_type, I explained you above why not.
Last edited by Sonic3R; 08-10-2011 at 02:42 AM..
|