my site here: when entering text in search input form page refreshes , appends "?" url.
however, when search link pressed, works fine. boggling mind why appending "?" haven't included code anywhere. intended behavior click link instead of refreshing page.
$(document).ready(function() { $("#coolirissearch").keydown(function(e) { if(e.keycode === 13) { $("#searchbutton").click(); return false; } }); docoolirissearch = function() { cooliris.embed.setfeedurl( 'http%3a%2f%2fpipes.yahooapis.com%2fpipes%2fpipe.run%3fsearch%3d'+encodeuricomponent($('#coolirissearch').val())+'%26_id%3d5f4545ce4062c36e4c5d9a8763b3167e%26_render%3drss' ); filter(); }; });
ok found answer. form field pretty strict. can't remove "submit" input field , change link. or else, output doing - appending "?" , name attribute of first input field. correct version:
<form name="searchform"> <input type="text" name="coolirissearch" id="coolirissearch" onfocus="this.value=''" /> <input type="submit" value="search" onclick="docoolirissearch();return false;" /> </form>
while version cause url append "?coolirissearch=" , reload page.
<form name="searchform"> <input type="text" name="coolirissearch" id="coolirissearch" onfocus="this.value=''" /> </form>
hope else finds helpful.
instead of adding click listeners buttons , key things inputs, try listening submit
event of forms.
$("#searchform").submit(function() { docoolirissearch(); return false; });
much simpler.
edit: tried debugging code using chrome's excellent web inspector , appears you're calling filter
id
sometimes, , without id
sometimes. can fix changing line:
document.getelementbyid(id).classname += " active";
to this:
if(id) { document.getelementbyid(id).classname += " active"; }
Comments
Post a Comment