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

select query
$i =1;
<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; ?>);"/>

function markValidation(a,b,i)
var c = parseInt(a); var d = parseInt(b);
alert("Mark Should be less than Total marks:"+d);
return false;

Recommended Answers

All 2 Replies

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

In my code, c is always less than d. But why it is not working?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.