嘿,jquery 和 hmtl5 范围有点麻烦。我试图在它们发生变化时获取值,但事件侦听器没有捕获它。目前我的代码是:
HTML
html += '<li>Apply Credits: <input type="range" min="0" max="'+credits+'" name="discount_credits" id="discount_credits" /> <span>'+credits+'</span></li>'
JS是:
$('#discount_credits').mousewheel( function() {
alert('it changed!');
alert('new value = ' + $(this).val());
});
我也试过
$('#discount_credits').change( function() {
alert('it changed!');
alert('new value = ' + $(this).val());
});
两者似乎都不起作用。难道我做错了什么?