开发者

jQuery Mobile click event using ajax navigation

I am using the jQuery mobile library (JQM) but am having an issue with a jQuery click event.

By default, JQM uses ajax page transitions to change the DOM. I have a search icon in the header where I want to add a simple click event:

$("#search-toggle").click(function(){
    alert("clicked");
});

This will work only for the home page as subsequent pages are all ajax/dom manipulations.

e.g. It wont work on

www.test.com/#/about

but would work on

www.test.com/about

I want to retain the page trans开发者_JS百科itions (ajax naviagation). How can I however get a simple click event to work with every new 'page'.

A.


sorted it:

$('#search-toggle').live('click', function() {
    alert("clicked");
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜