使用jquery搜索元素id或类 [英] Search element id or class by using jquery

查看:99
本文介绍了使用jquery搜索元素id或类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有列表视图,其中包括名称,按钮及其有10条记录,当我点击列表视图行上的按钮时,


i将其ID更改为$('#add')。removeAttr('id')。attr('id','1');

然后我禁用此按钮

$(this).closest(tr)。find('。add1')。attr(disabled,true)

并将此记录保存在另一个表列表中通过使用克隆方法查看



并将此按钮的类更改为删除





我的问题是假设首先我选择一个名称更改按钮id / class为1并克隆它

然后b名称更改按钮id / class为2,然后是c name然后是3,

如果我删除第二个表的b名称我如何搜索这个名称为id / class为2的名称行为2,禁用为true,我想让它禁用false



我尝试了什么:



i不知道如何搜索bu tton id / class


I have list view which include name ,button and its have 10 records,
when i clicked on button on list view row ,
i changed it's id as $('#add').removeAttr('id').attr('id', '1');
and then i disable this button
$(this).closest("tr").find('.add1').attr("disabled", true)
and save this record in another table list view by using clone method

and change the class of this button as remove


my question is suppose first i select a name change button id/class as 1 and clone it
then b name change button id/class as 2 ,then c name and then 3 ,
if i remove b name of second table how i search this b name row which have id/class is 2 which is disabled true , and i want make it disabled false

What I have tried:

i cant have any idea how to search button id/class

推荐答案

('#add')。removeAttr('id')。attr('id','1');

然后我禁用此按钮
('#add').removeAttr('id').attr('id', '1');
and then i disable this button


(this).closest(tr)。find('。add1')。attr(disabled, true)

并使用clone方法将此记录保存在另一个表列表视图中



并将此按钮的类更改为remove





我的问题是假设首先我选择一个名称更改按钮ID /类为1并克隆它

然后b名称更改按钮ID /类为2,然后是c名称然后是3,

如果我删除第二个表的b名称我如何搜索这个名称为id / class为2的名称行为2是的,我希望禁用它是假的



我尝试过:



i不知道如何搜索按钮id / class
(this).closest("tr").find('.add1').attr("disabled", true)
and save this record in another table list view by using clone method

and change the class of this button as remove


my question is suppose first i select a name change button id/class as 1 and clone it
then b name change button id/class as 2 ,then c name and then 3 ,
if i remove b name of second table how i search this b name row which have id/class is 2 which is disabled true , and i want make it disabled false

What I have tried:

i cant have any idea how to search button id/class


这篇关于使用jquery搜索元素id或类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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