开发者

refresh a javascript file after an event?

I am using a keynav plugin that allows me to navigate up and down though a list.

This list is dynamically generated using ajax and mysql. the suggesstions appear when someone begins to search into an input box.

if the user clicks off and the list closes and then begins a new search, when the list is generated the second time, the keyboard navigation breaks. I dont want the page to refresh but is there anyway to "refresh", "reload" the keyvav.js or possibly th开发者_如何转开发e function iteself after the user closes the list? so the file loads and hopefully works correctly when the user tries to search again.

 $('body').click(function() {
    $('#suggestions').fadeOut();
     .....do magic "refresh" .....
 });


Well if it is set up by the a init() function couldnt you just rerun that, but if you really want to reload the whole script you could get the file content with a ajax request then eval() it. not the best way because eval is murder on computers because it reboots the javascript encoder but it will do what you need

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜