I have problem with the following code :
function KeyCheck(e) {
// ... Some Code
for (var i = 0; i < length; i++) {
width = elements[i].offsetWidth;
if(width > 245) {
e.preventDefault();
}
}
}
As you can see I have a loop, I want only elements that are less than 245px to
have the event work, and the elements that are bigger than 245px not have it work.
The Problem – When the if ‘meets’ an element with width less than 245px it stops the loop and I think it exits the function also…
What can I do so it will continue looping and only elements less than 245px wide will get the event to work ?
Is this what you’re trying to do?: http://jsfiddle.net/D2xhz/
The bottom two inputs cannot be typed in.