Access HTML form data(Name,age,Mobile Number) using jQuery. (display in one alert box like Name,age,mobile number)

<!DOCTYPE html>

<html>

<head>

         <title></title>

         <script

  src="https://code.jquery.com/jquery-3.5.1.slim.min.js"

  integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs="

  crossorigin="anonymous"></script>

</head>

<body>

         <from>

                 name<input type="text"id="name"><br>

                 age:<input type="number" name=""id="age"><br>

                 mobile no:<input type="number" name="" id="mobile"><br>

                 <input type="submit" name="">

         </from><br>

         <label></label>

<script type="text/javascript">

         $("input[type='submit']").click(function(){

                 var name=$("#name").val();

                 var age=$("#age").val();

                 var mobile=$("#mobile").val();

   alert(name+age+mobile);

         })

</script>

</body>

</html>

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post