我已经搜索了stackoverflow,但我没有找到任何答案。根据属性更改按钮的文本
请检查下面的HTML
<button type="button" class="nacnchor" value="1">hello</button>
<button type="button" class="nacnchor" value="2">hello</button>
<button type="button" class="nacnchor" value="3">hello</button>
我可以基于类
$('button.nacnchor').text("REWRITE");
更改按钮的文本,但我想根据属性值更改值,是疗法类似的东西$('button.nacnchor,attr(value=1)')
:P 。
请详细说明。 –
你在问如何选择一个具有特定值的元素?或者如何使用value属性来改变文本? – musefan
我需要根据其属性“值”更改按钮的文本...如果我提到1应改变第一个按钮 – Vishnu