How to make a permanent change to an element after using jQuery's .keydown()? -
i have following jquery code:
function showresult(str) { if (str.length == 0) { $('#mysearch').html(''); return; } else { $('#mysearch').load('search/'+str,function(){ $('#mysearch').css({ 'background-color': 'white', 'width': '250px', 'position': 'absolute', 'right': '0' }) }); } $(document).click(function(event) { if ( !$(event.target).hasclass('mysearch')) { $('#mysearch').html(''); $('#main_search').val(''); } }); $(document).keydown(function(e){ if (e.keycode == 40) { $('#mysearch tr.myrow:first').addclass("a_classy_class"); return false; } }); }
when press down arrow key class 'a_classy_class' added tag id 'myrow'. however, stop pressing down arrow key class removed. how make change permanent, after stop pressing down arrow key change holds?
in addition other suggestions, if page reloaded, changes not persist.
Comments
Post a Comment