[英]How to load a div using jQuery after moving the focus to an input field?
將焦點移動到輸入字段后如何加載div? 這意味着當我的光標放在輸入字段中時,我想在輸入字段的正下方加載一個div。 請幫助我,我是jQuery的新手,不知道我該怎么做。
這與jQuery相當直接:
$('#myInput').on('focus', function(){
$(this).after('<div />').html('whatever goes in the div');
})
...但是,從哪里獲得div的內容是另一個問題。 你需要從服務器端加載嗎?
嘗試這個:
$( "#target" ).focus(function() {
$( this ).after( "<div>Test</div>" );
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.