[英]Jquery Mobile on() function does not work as a replace to my live function
Its probabaly a very old problem I am trying to replace a pop up which is written in jquery mobile 1.0.1 , and jquery 1.6.4. 它可能是一个非常老的问题,我正在尝试替换用jquery mobile 1.0.1和jquery 1.6.4编写的弹出窗口。 I am currently trying to use jquery mobile 1.3.2 and jquery 1.9.1.
我目前正在尝试使用jquery mobile 1.3.2和jquery 1.9.1。
The piece of code I am struggling with changing is as follows 我努力改变的代码如下
$("select[id='action_menu']").live("change",actionHandler);
to this 对此
$(document).on('click', "(select[id='action_menu'])", actionHandler ); $(document).on('click',“(select [id ='action_menu']))”,actionHandler);
or if anyone has a better suggestion also the look and feel of the pop has changed a lot from the older version. 或者如果有人有更好的建议,那么流行音乐的外观和风格与旧版本相比已经发生了很大变化。
link to Fiddle with all the js and css files http://jsfiddle.net/hgafoor/85qy3/ 与所有js和CSS文件链接到Fiddle http://jsfiddle.net/hgafoor/85qy3/
您需要修正报价:
$(document).on('click', "(select[id='action_menu'])", actionHandler );
This is how it worked for me, fairly clean and simple credits to Omar for being such a great help. 这就是它的工作方式,对我来说,Omar这么出色的帮助非常干净,简单。
$("select").on("change", function () {
if ($(this).val() == 'home') {
window.location.href = 'google.com';
} else {
window.location.href = 'mail.google.com';
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.