我有一个input
字段和span
,如下所示,想replace
text
span
。
<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')
有人能告诉我这里有什么不对吗?谢谢。
答案 0 :(得分:1)
尝试使用.text()
代替.val()
$('input[name="buyer_signup_email"]').next().text('dd')