use jquery variable code example
Example 1: jquery declare variable
var foo = 'some string';
// Popular pattern for variables that contains the result of a call in HTML:
var $foo = $('.foo'); // it's a valid name in jQuery
Example 2: use jquery variable in html
<script>
$(document).ready(function(){
var inputvalue = "field 1";
$('#id1').val(inputvalue);
});
</script>
<html>
<body>
<div><input id="id1" value=""></div>
</body>
</html>
Example 3: jquery use variable in string
console.log(`${a + b}`);