我想在纯JS或jQuery上设置一个atribute onchange值auto()
。
元素名称:
let autofilling = document.getElementsByName('butterbean_stm_car_manager_setting_autofilling');
我试过了
<script type="text/javascript">
let autofilling = document.getElementsByName('butterbean_stm_car_manager_setting_autofilling');
jQuery(document).ready(function($) {
$( "[name='butterbean_stm_car_manager_setting_autofilling']" ).change(function(){
if(autofilling == 'electro'){
console.log('test');
};
});
});
</script>
选择在div中,id=“butterbean-control-autofilling”,所以我可以使用让autofilling=document.getElementById(“butterbean-control-autofilling”)。选择
吗?
$(*your element selector here*)[0].addEventListener('change', (event) => {
...
});