My JQuery Assignment(s) solutions

ASSIGNMENT - BUTTON CLICK & ALERT
Finally was able to figure out, what I think to be the solution to the assignment

<!DOCTYPE html>
<html>
<style>
  </style>
  <head>

    <title>hello world</title>
<script src=  http://code.jquery.com/jquery-latest.js>

</script>

  </head>
  <body>

  <form>
    <input class="text" placeholder="type here"></input>
    <button id= "buttonAlert" class="button" name ="testButton">submit</button>
</form>

<script>
$(document).ready(function() {

  function functionName() {

      alert ("success!");

    };

    $("#buttonAlert").click(function() {

    functionName()
  });
})

</script>

  </body>
</html>

ASSIGNMENT - TEXT INPUT ALERT

<head>

    <title>hello world</title>
<script src=  http://code.jquery.com/jquery-latest.js>

</script>

  </head>
  <body>

  <form>
  <input id= "inPut" class="text" placeholder="type here"></input>
  <button id= "buttonAlert" class="button" name ="testButton">submit</button>
</form>

<script>

  function functionName() {

      alert ($('#inPut').val());

    };

    $("#buttonAlert").click(function() {

    functionName()
  })

</script>

  </body>

Curious to see what other solutions, if any, people came up with!

1 Like