<script>
  $(document).ready(function(){
    let btnColorRed = $('.red');
    let btnColorBlue = $('.blue');
    let root = $(':root');
    btnColorRed.click(function() {
      root.attr('style', '--color: #e74c3c');
    });
    btnColorBlue.click(function() {
      root.attr('style', '--color: #7f8c8d');
    });
  });
</script>
把以下代码改写为jqueryscript let btnColorRed = documentquerySelectorred; let btnColorBlue = documentquerySelectorblue; let root = documentquerySelectorroot; btnColorRedaddEventListenerclick function r

原文地址: http://www.cveoy.top/t/topic/dUxi 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录