How does jq get the value of the page code including input

$("html"). Html () can only get the code of the page. If input enters the content but cannot get it, how can you get the code of the page together with the value of input

  console.log($("html").html())
  console.log($("-sharptest").val())
Mar.02,2021

you need to understand the function of .val () of jq; in the case of the value, you do get it; but you don't assign it; you assign it first; you can see

only when you print .html ().
<input type="text" class="input">

------------------------------------
 $(".input").attr('value',$('.input').val())
 console.log($("html").html());

$(document).keyup(function (event) {
    console.log($('html').html())
    console.log($("-sharptest").val())
});

<input type="text" id="test">
// 
$("-sharptest").keyup(function(){
    $(this).attr("value",$(this).val());
})
// 
console.log($('html').html())
console.log($("-sharptest").attr("value"))

Code order

Menu