Jquery: Returning Value From Trigger

后端 未结 6 791
轮回少年
轮回少年 2021-02-02 10:14

I am using a trigger call a get a value from custom event but I want it to return a value and its only giving me Object Object when I do the following call:

var          


        
6条回答
  •  星月不相逢
    2021-02-02 10:23

    What you can do is use .triggerHandler() instead of .trigger(). This will return a value.

    var user_id=$("#my_div").triggerHandler("get_id", [username]);
    

提交回复
热议问题