javascript - jQuery Plugin to Update URL Hash As Text Input Changes -
is there jquery plugin update url hash of page user types text text input?
i know rather simple, looking "smart" one, such google instant search or caniuse.com, doesn't update hash on every keyup() event, rather when user has stopped typing given period of time or text input blurs.
i know sit down , write plugin myself, have written several before, hoping suggest 1 has been written don't have reinvent wheel.
thank time.
not difficult. untested code:
var hashto; $('#mytextfield').on('keyup', function() { if(hashto !== undefined) { cleartimeout(hashto); } hashto = settimeout(updatehash, 1000); }); function updatehash() { var hashval = encodeuricomponent($('#mytextfield').val()); window.location.hash = hashval; }
Comments
Post a Comment