Enable Backspace With Jquery Oninput Event Within The Text On An Input Form?
I have an input form that has a jQuery event applied to it that creates square brackets around the users input. The issue is that the event prevents the ability to use backspace to
Solution 1:
function test(obj,e) {
if(!(e.which == 8)){
var oldVal = obj.val().replace(/\[/g,'');
oldVal = oldVal.replace(/\]/g,'');
var val = '[' + oldVal + ']';
obj.val(val);
}
}
and pass event as parameter ..
<input class="text-box" onkeyup="test($(this),event)">
Post a Comment for "Enable Backspace With Jquery Oninput Event Within The Text On An Input Form?"