Display cancel button only when we edit the value inside textfield
by kapil sharma
HTML
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="//code.jquery.com/jquery-1.11.3.min.js"></script>
<input class="ama1" type = "text" name= "price[]" value = "55" style = ""/>
<input type="hidden" class="test_class" name="hid" value="55" />
<span><span class="cancle_button" style="display: none;"> "Cancel"; </span></span>
JavaScript
$(document).ready(function () {
$('.ama1').keyup(function () {
var hid_val = $('.test_class').val();
var cur_val = $(this).val();
console.log(cur_val);
if (hid_val != cur_val) {
$('.cancle_button').show();
} else {
$('.cancle_button').hide();
}
$('.cancle_button').toggle(hid_val != cur_val)
})
})