简体   繁体   中英

popup trigger when click the input field in jquery mobile?

I am create a jquery mobile website.I want a popup raised when i click a input field.

<input type="text" class="popup_trigger" name="type_of_services" placeholder="Type Of Services" data-rel="popup" data-transition="pop" data-clear-btn="true">

<div data-role="popup" id="popup_service" class="popup_service">
   <label for="check_box"><input type="checkbox" name="checkbox-0">service</label>
</div>

jquery code :

$(document).ready(function() {
   $(".popup_trigger").click(function() {
      $("#popup_service").popup();
   });
});

I also try

$(".popup_service").popup();

Try this code:

$('.popup_triger').on('click', function () {
  $("#popup_service").popup('open');
});

You should use open method.

Try this:

$(document).on('click', '.popup_triger', function () {
  $("#popup_service").popup();
});

also don't use above event inside $(document).ready();

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