开发者

jQuery Mobile click event using ajax navigation

开发者 https://www.devze.com 2023-03-14 18:32 出处:网络
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 w

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

精彩评论

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