![](/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.