我有一個input
字段和span
像下面那樣想要replace
text
在span
。更改下一個元素jquery的值
<div>
<input autofocus="autofocus" type="email" value="" name="buyer_signup_email" id="buyer_signup_email" autocomplete="off">
//want to change below elements text
<span class="help-block red-text">will change this text</span>
</div>
我試過,但沒有工作
$('input[name="buyer_signup_email"]').next().val('dd')
有人能告訴我什麼是錯在這裏?謝謝。
中肯下面的接受的答案,在'VAL()'屬性是嚴格的表單元素,比如你的'input'元素。這也是最終提交的價值。 'text()'屬性是_container_元素的文本內容,比如你的'span'元素。 – Manngo
@Manngo想知道爲什麼..謝謝你的解釋.. – Abhilash