如何獲得HTML的輸入標籤還集中或不使用jQuery如何獲得輸入具有焦點或不使用jQuery
keydown事件會爲形式的工作,如果輸入,圖像等標籤具有焦點。但它不會工作,它集中在形式上,而不是像輸入,圖像等任何標籤。 我該如何解決這個問題。 請幫助 在此先感謝
$('#title').focusout(function()
{
if($(document.activeElement).is(":focus"))
{
alert('focus');
}
else
{
alert('not focus');
}
});
//這是不行的
檢查這裏:http://stackoverflow.com/questions/967096/using-jquery-to-test-if-an-input-has-focus – ddinchev