0

Focus not working. What is the error in my code
Dynamic Textbox Code:

select query
$i =1;
while()
{
<input type="text" name="class_teacher_entry[]" id="class_teacher_entry<?php echo $i; ?>" class='marks' size="5"  maxlength="3" onkeypress="return onlyNumbers(event);" onblur="markValidation(this.value,document.getElementById('marktotal').value,<?php echo $i; ?>);"/>
}


<Script>
function markValidation(a,b,i)
{
var c = parseInt(a); var d = parseInt(b);
if(c>d)
{
alert("Mark Should be less than Total marks:"+d);
document.getElementById('class_teacher_entry'+i).value='';
document.getElementById('class_teacher_entry'+i).focus();
return false;
}
}
</Script> 
2
Contributors
2
Replies
13
Views
1 Year
Discussion Span
Last Post by AntonyRayan
0

No errors in your console log? Or is c never greater than d (the onblur is firing but your output never happens)?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.