Prototype的activate功能的什麼是jQuery的等效原型函數.activate()
將焦點到表單控件,並且如果它是根據文本輸入
選擇其內容原型網站。即
$('my_element_id').activate();
jQuery中的等效函數是什麼?
Prototype的activate功能的什麼是jQuery的等效原型函數.activate()
將焦點到表單控件,並且如果它是根據文本輸入
選擇其內容原型網站。即
$('my_element_id').activate();
jQuery中的等效函數是什麼?
$('my_element_id').focus();
jQuerys focus()
方法的快捷方式不選擇在輸入字段中的文本。取而代之的是,添加select()
:
$('my_element_id').focus().select();
原型的activate()函數集中在和選擇的形式的元素的全部內容。
jQuery中,這種行爲可以用三個功能被複制:
// Focus
$('my_element_id').focus();
// Focus and select the content.
$('my_element_id').focus().select();
// Focus and select the content without problems in Google chrome
$('my_element_id').focus().select().mouseup(function(event){
event.preventDefault();
});
但這並不選擇輸入字段的內容,不是嗎? – acme 2011-10-20 13:03:24