我在输入中有一个带有文本提示的表单。我知道如何删除焦点上的文本,但是如果有人在没有输入任何内容的情况下点击它,我该如何将其添加回来?
<form class="grid">
<section>
<label id="top">Create New Contact</label>
</section>
<section>
<span class="field"><input type="input" class="regular" id="firtName" value="First Name"></input></span>
</section>
<section>
<span class="field"><input type="input" class="regular" value="Last Name"></input></span>
</section>
<section>
<span class="field"><input type="input" class="regular" value="Salutation"></input></span>
</section>
<section>
<span class="field"><input type="input" class="regular" value="Title"></input></span>
</section>
<section>
<span class="field"><input type="input" class="regular" value="Department"></input></span>
</section>
<section>
<span class="field"><input type="input" class="regular" value="Accountant"></input></span>
</section>
<section>
<div id="lineDiv"></div>
</section>
<section>
<a href="#" class="cancel" data-role="button" data-inline="true" data-mini="true">Cancel</a>
<a href="#" id="save" data-role="button" data-inline="true" data-mini="true">Save</a>
</section>
</form>
jQuery('input').focus(function() {
jQuery(this).val('');
});