如何从表中获取与jquery中的checked复选框对应的span的值 [英] How to get value of the span corresponding to the checked checkbox in jquery from a Table

查看:75
本文介绍了如何从表中获取与jquery中的checked复选框对应的span的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个要求,我需要根据选中的相应复选框选择范围的值(内部文本)。

我可以通过执行每个函数来获取复选复选框的值 -



  var  fIds = []; 
$( #tblSearchResult input:checkbox [name = assignChkBx]:checked)。 each( function (){
var id = $( this )。attr( value);
fIds .push( + id + );
});





我怎样才能获得相应跨度的值,以便与复选框值一起,我可以将span的文字附加到fIds?



请提供输入!!!



谢谢

解决方案

#tblSearchResult input:checkbox [name = assignChkBx] :选中)。each( function (){
var id =


this )。attr( value);
fIds.push( + id + );
});





我怎样才能获得相应跨度的值,以便与复选框值一起,我可以将span的文字附加到fIds?



请提供输入!!!



谢谢


这是您的解决方案...



<前lang =Javascript>


Hi,
I am having a requirement, where i need to select the span's value(inner Text)depending on the corresponding checkbox checked.
I am able to get the value of the checked checkbox by performing the each function--

var fIds = [];
       $("#tblSearchResult input:checkbox[name=assignChkBx]:checked").each(function () {
           var id = $(this).attr("value");
           fIds.push("" + id + "");
       });



how can i get the value of the corresponding span as well here so that along with the checkbox value, i can append span's text also to the fIds?

Please provide inputs!!!

Thanks

解决方案

("#tblSearchResult input:checkbox[name=assignChkBx]:checked").each(function () { var id =


(this).attr("value"); fIds.push("" + id + ""); });



how can i get the value of the corresponding span as well here so that along with the checkbox value, i can append span's text also to the fIds?

Please provide inputs!!!

Thanks


here is your solution...


这篇关于如何从表中获取与jquery中的checked复选框对应的span的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆