How is the click event realized? Trigger click event?

< script >

            
  (function($, doc) {
     $(".save").click(function(){
            alert(1)
        })

    $.init();
    $.ready(function() {
      /**
       * 
       * ;
       * @param {Object} obj 
       * @param {String} param 
       */
      var _getParam = function(obj, param) {
        return obj[param] || "";
      };
     //
      var cityPicker3 = new $.PopPicker({
        layer: 3
      });
      cityPicker3.setData(cityData3);
      var showCityPickerButton = doc.getElementById("showCityPicker3");
      var cityResult3 = doc.getElementById("cityResult3");
      showCityPickerButton.addEventListener("tap", function(event) {
        cityPicker3.show(function(items) {
          cityResult3.innerText =  _getParam(items[0], "text") + " " + _getParam(items[1], "text") + " " + _getParam(items[2], "text");
          // false 
          //return false;
        });
      }, false);
    });
  })(mui, document);

clipboard.png

clipboard.png

Feb.27,2021

$(".save").on('click',function(){
    alert(1)
})

if you are using jq, it is indeed in the wrong format. Click () is the calling method, not the delegate event


document . Does mui provide click method?


jquery binds events in this way. On listening events can also be bound. Binding this short segment of click events is certainly no problem. It should be a problem elsewhere.


$(".save").eq(0).click(function(){
            alert(1)
        }).trigger('click'),

try using on, tie the event to the parent element, and use the event proxy to find .save

.
Menu