Q:

How to convert JavaScript to JQuery?

How do I convert this into JQuery?
function contantForm()
{
    let Username = document.getElementById("Username").value;  //create element Id called Username
    let Emailinput = document.getElementById("Email").value; //create element Id called Emailinput
    alert("Thank you " + Username) //alerts user with thier username after clicking submit
    document.getElementById("Username").value=""; //get username Id from index page
    document.getElementById("Email").value=""; //get email Id from index page
    document.getElementById("Phone").value=""; //get phone Id from index page
}

Thanks,

A:

pure  JS and Jquery can work together, your code always work with or without jquery, but if you want all codes in same format then.

function contantForm()
{
    let Username = $("#Username").val();  
    let Emailinput = $("#Email").val(); 
    alert("Thank you " + Username) 
    $("#Username").val(""); 
    $("#Email").val(""); 
    $("#Phone").val(""); 
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

