How to send multiple arguments to jQuery click function?

一个人想着一个人 提交于 2019-11-30 12:53:16
ChaosPandion

jQuery Events

jQuery .click()

$('.myclass').bind("click", { Param1: "", Param2: 2 }, function(event){
    alert(event.data.Param2);
});

you can use bind() and send additional data to the event handler as event.data

this may not be the best method, but something i have done is to hyphen delineate the id attribute with other params, like id="101-red-420582" which all three mean different things and can be easily broken down using the split() function. not the best, per se, but i've done it and it works.

Anshu

Quick Solution

<p class="msg_head" id="837" rel="a" **till_limit="9"**>Header-1 </p>

and you can refer as

 $(this).attr('till_limit');

This is similar solution like define your own ID and refer the element as per your requirement.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!