[英]Internal page refresh with JavaScript
I have a form and everytime some performs a onchange()-event, the page should run my javascript code again (but a refresh of the page using a new url request is not an option). 我有一个表单,每次有人执行onchange()-event时,页面应再次运行我的javascript代码(但不能使用新的url请求刷新页面)。
Any idea? 任何想法? I know this must be very simple.
我知道这一定很简单。
my javascript-code: 我的JavaScript代码:
$(document).ready(function(){
formObject = document.forms['newBom'];
var vendor = formObject.elements['inptHardware'].value;
console.log('selected vendor: ' + vendor);
var product = formObject.elements['inptProduct'].value;
console.log('selected product: ' + product);
});
This should do the trick: 这应该可以解决问题:
$('form[name="newBom"] :input').change(function() {
// your code there
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.