Friday, 7 May 2021

JQUERY23

 <html>

<head>

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

 <script>

$(document).ready(function(){

var left_position = $("#name2").offset().left - $(document).scrollTop();

$('#parray').text(left_position);

var top_position = $("#name2").offset().top - $(document).scrollTop();

$('#iarray').text(top_position);

});

</script>

</head>

<body>

 First name:<br>

<input type="text" id="name1" name="firstname" value="Adhira">

<br><br><br><br>

Last name:<br>

<input type="text" id="name2" name="lastname" value="Ranjegaonkar">

<br><br>

 <p id="parray"></p>

<p id="iarray"></p>

 </body>

</html>