lundi 15 mars 2021

Can Someone Help Me Make My Checkbox a Different Color? Here's My Code

This is the code that I'm using. I can't figure out how to add css so that the checkmark will turn a different color. (other than blue)

<!DOCTYPE html>
    <html>
    <link rel="stylesheet" href="u.css">
    <script type="text/javascript" src="homesearch.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
        <div class="wrap">
      <div id="checkbox-container">
            <input type="checkbox" id="name" name="new_background" color="red"/>
      </div>
      </div>
    </label>
    
    <script>
        var checkboxValue = JSON.parse(localStorage.getItem('checkboxValue')) || {}
        var $checkbox = $("#checkbox-container :checkbox");
    
        $checkbox.on("change", function() {
          $checkbox.each(function() {
            checkboxValue[this.id] = this.checked;
          });
          localStorage.setItem("checkboxValue", JSON.stringify(checkboxValue));
        });
    
        //on page load
        $.each(checkboxValue, function(key, value) {
          $("#" + key).prop('checked', value);
        });
    </script>
    <body>
    </body>
    </html>



Aucun commentaire:

Enregistrer un commentaire