aguisa
asked on
JQUERY function not working
Hi. I have the following code in my app. The thing is that it is not working as expected. I have several input fields that are identified by id = hord1, hord2 ...., hordn. What I want is to validate every one of them on blur. Thanks.
var nrows = 0;
$(document).ready(function (){
var xj = 1;
updaterows();
while (xj <= nrows){
$("#hord"+xj).blur(functio n(){
alert (xj);
validarord(xj);
});
xj++;
}
});
var nrows = 0;
$(document).ready(function
var xj = 1;
updaterows();
while (xj <= nrows){
$("#hord"+xj).blur(functio
alert (xj);
validarord(xj);
});
xj++;
}
});
ASKER
Hi, updaterows() updates the value of nrows, which throw 32 at my context. Thanks for the fast response.
if updaterows(); use ajax, you may to use :
http://api.jquery.com/attribute-starts-with-selector/
and :
http://api.jquery.com/live/
http://api.jquery.com/attribute-starts-with-selector/
and :
http://api.jquery.com/live/
$(document).ready(function(){
var xj = 1;
updaterows();
$("input[id^='hord'"]).live("blur", function(){
alert (xj);
validarord(xj);
});
});
>Hi, updaterows() updates the value of nrows, which throw 32 at my context. Thanks for the fast response.
Yes, but you did not answer to my question. Line 5 we placed an alert which should give the number of row. Confirm you get 0
Yes, but you did not answer to my question. Line 5 we placed an alert which should give the number of row. Confirm you get 0
try something like this
$('input:text[id^=hord]').blur(function() {
that should if formed right get you every input field with an id that starts with hord.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I couldn't follow up what you suggested. Thanks anyway.
Open in new window