![](/img/trans.png)
[英]Fire off JavaScript function when textbox is populated and focus is still set in jQuery?
[英]Javascript and Jquery fire function when textbox changes
單擊按鈕時如何觸發這些功能? 當某些文本發生更改時,我需要運行它。 但是我的頁面上有一個按鈕..當我鍵入它時,它會更改,但是當我使用按鈕來更改值時,它不會觸發函數(代碼)
$(document).ready(function(){
var text1 = $(':text'),
text2 = $(':text'),
text3 = $(':text'),
text4 = $(':text'),
activeInput = text1;
activeInput.focus();
$(':text').on('focus', function(){
activeInput = $(this);
});
$(':button').on('click', function(){
activeInput.val(activeInput.val()+ $(this).val());
$('#dec').change(function(){
fromdecimal();
})
$('#bin').bind('change click ', function(){
frombinary();
})
$('#hex').bind('change click',function(){
fromhexadecimal();
})
$('#oct').bind('change click',function(){
fromoctal();
})
});
});
您是否使用:(冒號)選擇課程? 如果是,那么您做錯了。
采用 。 (點)選擇類
var text = $('.text');
對於其他任何問題,請顯示您的html代碼。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.