jQuery ON error. No error when using LIVE -
this question has answer here:
- turning live() on() in jquery 5 answers
- jquery live vs on 2 answers
this current, want change .live .on not working..
$('#searchstring').live('keydown',function(e) { if (e.which == 13) { if (!$("#searchstring").val()) { alert("inget postnummer eller ort angiven!"); return false; } } }); $('#searchstring').on('keydown',function(e) { if (e.which == 13) { if (!$("#searchstring").val()) { alert("inget postnummer eller ort angiven!"); return false; } } });
this on version
in event delegation model of on() target element selector passed second argument on()
method.
$(document).on('keydown', '#searchstring', function(e){ if (e.which == 13) { if (!$("#searchstring").val()) { alert("inget postnummer eller ort angiven!"); return false; } } })
Comments
Post a Comment