I want to empty the input value when another input value has changed.
I tried this code, but not working yet. Any idea to solve this issue?
Thanks in advance.
<div class="continer">
<input type="text" class="type" id="type" value="">
<input type="text" class="model" id="model" value="">
</div>
<script>
$("#type").on('keydown', function() {
var key = event.keyCode || event.charCode;
if( key == 8 || key == 46 )
$("#model").empty();
});
</script>
>Solution :
you can use change event to trigger the change event and .val() method to set the value of the other inputs , like that
<script>
$("#type").on('change', function() {
$("#model").val("");
});
</script>