jQuery值选择器 [英] jQuery value selector

查看:102
本文介绍了jQuery值选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有:

I have:

<button class="Delete" value="1">Delete</button>
<button class="Delete" value="2">Delete</button>
<button class="Delete" value="3">Delete</button>

给定包含一个值的变量X(在本例中为1,2或3) ,那么我该如何隐藏对应于X中的值的按钮?

Given variable X that contains a value (in this case either a 1, a 2 or a 3), then how do I hide the button corresponding to the value in X?

我想说一些类似的内容:

I want to say something like:

$('button').val(x).hide();

含义:按钮的值为x,隐藏。

Meaning: "The button whose value is x, hide".

推荐答案

$('button[value="' + x + '"]').hide();

这篇关于jQuery值选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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