I am trying to get the new value of the textbox but I always get the old one. Please help
I have a input type text with a value generated on PHP.
$description = "Pink Tie";
<input type="text" id="txtDesc" value="<?php echo $description ?>" />
<button type="submit" onclick="updateDesc();">Update</button>
Output: "Pink Tie"
Let say I changed it to "Blue Tie", then get the new description on jQuery
On JS:
function updateDesc(){
var desc = $( "#txtDesc" ).val();
alert(desc);
}
Output: "Pink Tie"
I get the same output. How will I get the new input?