简体   繁体   中英

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. I am currently trying to use jquery mobile 1.3.2 and 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 );

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/

您需要修正报价:

$(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.

 $("select").on("change", function () { 
   if ($(this).val() == 'home') { 
   window.location.href = 'google.com'; 
   } else { 
  window.location.href = 'mail.google.com'; 
  } 
  });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM