0
嗯,我有問題,因爲如何交換輸入佔位符文本與跨文本? ...交換輸入佔位符文本與跨文本jquery
<div class="form-inputs">
<div class="control-group string required user_name error error_state">
<label class="string required control-label" for="user_name"><abbr title=
"required">*</abbr> Name</label>
<div class="controls">
<div class="input-prepend">
<input class="string required" id="user_name" maxlength="100" name=
"user[name]" pattern="^[^0-9`[email protected]#\$%\^&*+_=]+$" placeholder=
"Full Name" size="50" type="text" value="" />
</div>
<span class="help-inline">can't be blank</span>
</div>
</div>
<div class="control-group email required user_email error input-error">
<label class="email required control-label" for="user_email"><abbr title=
"required">*</abbr> Email</label>
<div class="controls">
<div class="input-prepend">
<input class="string email required" id="user_email" maxlength="255"
name="user[email]" pattern="\A[^@\s][email protected]([^@\s]+\.)+[^@\s]+\z" placeholder=
"Email" size="50" type="text" value="" />
</div>
<span class="help-inline">can't be blank</span>
</div>
</div>
<div class="control-group password required user_password error input-error">
<label class="password required control-label" for=
"user_password"><abbr title="required">*</abbr> Password</label>
<div class="controls">
<div class="input-prepend">
<input class="password optional" id="user_password" maxlength="128" name=
"user[password]" placeholder="Password" size="50" type="password" />
</div>
<span class="help-inline">can't be blank</span>
</div>
</div>
</div>
我的Rails代碼將跨度與類「求助在線」如果存在對提交錯誤......這個跨度不是添加到輸入,如果沒有錯誤...
如何使用span文本交換輸入佔位符文本? ...對於形式中的每個輸入...
例如...如果第一個字段中有錯誤,我想將佔位符文本「全名」更改爲「不能爲空」。 。
非常感謝......
嘿感謝您的幫助...但dosent似乎工作..現在即時通訊越來越沒有佔位.... – SkyKOG
@SkyKOG啊,我更新的代碼,請參閱此演示'--->'http://jsfiddle.net/RhMj9/3/ –
Thnaks再一次:) ... $(「#user_name」)。prop「placeholder」,$(「#user_name」) ().parent()。next(「。help-inline」)。text()if $(「#user_name」)。parent()。next(「。help-inline」).text()。length – SkyKOG