JQuery array problem?
JQuery array problem?
Hi,
I have an array like this:
var = array1{ id1:"value1", id2:"value2", id3:"value3", id4:"value4"};
I need to compare these array items to my site div id's and make an onblur functionality that changes the input field value.
$('input').live('blur',function(){
if (this.value == "valuetocheck") {
$.each(array1, function(key, vall) {
if (this.id == key) {
this.value = vall;
alert('got this far...'); }
}
});
It does not change the selected input field value(this.value). And it only alerts when blurring from the input field that is first in the array(id1). If i click to the input field id="id2" it does not alarm? Thanks for all help!