Menu Zavřeno

Java Script – jQuery

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title></title>
    <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">
    <link rel="stylesheet" href="https://www.w3schools.com/lib/w3-colors-highway.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
  </head>
  <body>
    <h1 id="nadpis1">jQuery</h1>
    <button id="barva" barva="w3-blue" class="w3-blue w3-round-large w3-margin-large" type="button" name="button">Tlačítko</button>
    <button id="barva" barva="w3-re" class="w3-red w3-round-large w3-margin-large" type="button" name="button">Tlačítko</button>
    <button id="barva" barva="w3-green" class="w3-green w3-round-large w3-margin-large" type="button" name="button">Tlačítko</button>
    <button id="barva" barva="w3-black" class="w3-black w3-round-large w3-margin-large" type="button" name="button">Tlačítko</button>
  
  </body>
  <script type="text/javascript">
    $(document).ready(function(){
    $("").click(function(){
      $("#nadpis1").removeClass("w3-red");
$("#nadpis1").addClass($(this).attr("barva"));
    });
  });
  </script>
</html>