我有以下jQuery函數:jQuery的模糊()和點擊()
1)提交表單
$(".content").delegate('.entryButton','click', function() {
var form = $(this).closest("form");
var id = form.attr('id');
var text = form.find("textarea").val();
Sijax.request('add_entry', [id, text]);
//Prevent the form from being submitted (default HTML)
return false;
});
2)放大的形式並顯示輸入按鈕
$("textarea").focus(function() {
$(this).css('height', '80px');
var button = $(this).parent().next().children();
button.css('visibility', 'visible');
button.css('height', '20px')
});
3)縮小文本區域並隱藏按鈕
$("textarea").blur(function() {
$(this).css('height', '30px');
var button = $(this).parent().next().children();
button.css('height', '0px')
});
發生這種情況時,我試圖讓一個條目:
- 點擊在該領域(focus事件),現場變得更大,並顯示輸入按鈕
- 輸入文本
- 點擊進入按鈕第一時間:現在模糊事件觸發至極讓現場再次小,但單擊事件不火
- 如果我點擊一次按鈕的形式提交不
我認爲這意味着模糊和點擊事件互相干擾?
你可以找到問題here的小提琴。當您按下焦點領域的按鈕時,它會模糊區域但不會進入。當您按下字段模糊的按鈕時,該條目將被提交。
任何想法?
在此先感謝!
你能建立一個的jsfiddle示範問題?用小提琴編輯的 – Snuffleupagus
! – arnoutaertgeerts