如何将按钮文本传递给按钮单击事件 [英] How to pass button text to button click event
本文介绍了如何将按钮文本传递给按钮单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想添加按钮文字以点击事件。但我不知道该怎么办!!
我尝试了什么:
i want to add button text to click event.but i don't know how can i do !!
What I have tried:
<button class="btn btn-success user" data-bind="attr: { 'data-cid': ConnectionId, 'title': Username }">Video Call</button>
<button class="btn btn-success user" data-bind="attr: { 'data-cid': ConnectionId, 'title': Username }">Audio Call</button>
我点击evnet
and i have click evnet
$('.user').live('click', function () {
//Here i required button click text
// Find the target user's SignalR client id
var targetConnectionId = $(this).attr('data-cid');
}
}
推荐答案
('。 user')。live('click',function(){
//这里我需要按钮点击文本
//找到目标用户的SignalR客户端ID
var targetConnectionId =
('.user').live('click', function () { //Here i required button click text // Find the target user's SignalR client id var targetConnectionId =
(this).attr('data-cid');
(this).attr('data-cid');
}
}
试试这个:使用jquery:
try this: using jquery:
这篇关于如何将按钮文本传递给按钮单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文