當我點擊進入textarea時,有沒有辦法刪除標籤?點擊textarea隱藏標籤值
http://jsfiddle.net/1smvym84/4/
HTML:
<li id='field_1_9' class='gfield' >
<label class='gfield_label' for='input_1_9'>Place this inside the textarea</label>
<div class='ginput_container'>
<textarea name='input_9' id='input_1_9' class='textarea medium' tabindex='8' rows='10' cols='50'></textarea>
</div>
</li>
JQUERY:
$(document).ready(function(){
$('.textarea').text($('.gfield_label').text());
$('.gfield_label').remove();
});
非常感謝:-)
你在哪裏卡住了?您尚未發佈點擊事件。 – 2015-01-26 20:20:35
爲什麼不使用佔位符? – 2015-01-26 20:21:39
您的標籤已經在您的'ready'功能中被刪除!實際上,考慮用'attr'將它設置爲佔位符,而不是用'text'將其設置爲內容。 – Pevara 2015-01-26 20:26:04