User665608656 posted
Hi progy85,
As @bruce said, you can achieve your needs by triggering input
events.
The input event allows you to trigger the event immediately when pasting or putting, without requiring you to click again.
For the click event to change the value of the input, you can achieve it by calling the event triggered by the input again.
For details, you can refer to the following code:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script src="../Scripts/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
$(function () {
$("#dvrunat").click(function () {
$("#txtGive").val("3");
ChangeGive();
})
$('#txtGive').on('input', function (e) {
ChangeGive();
});
});
function ChangeGive() {
$("#dgear").addClass("Drive");
var spdvalue = $("#txtGive").val();
var initDegree = -120;
var lastDegree = 120;
var rotateDeg;
if (spdvalue <= 240) {
rotateDeg = initDegree + Math.round(spdvalue / 2);
}
else if (spdvalue > 240 && spdvalue < 480) {
rotateDeg = Math.round(spdvalue / 2) - lastDegree;
}
alert(rotateDeg);
}
</script>
<style>
.Drive {
width: 300px;
height: 200px;
background-color: antiquewhite;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<div id="dgear">
<input id="txtGive" type="text" />
<input id="dvrunat" type="button" value="change give value" />
</div>
</div>
</form>
</body>
</html>
Here is the result of this work demo:

Best Regards,
YongQing.