I am setting the value of the text field using this function:
var end_limit = 'data';
jQuery(document).on('change', 'select[name=txtSetValue]', function() {
jQuery("input[name=time]").prop('disabled', false);
jQuery('input[name=time]').data('endtime', end_limit);
});
jQuery(document).on('change', '.get_value', function() {
console.log(jQuery("input[name=time]").data('endtime'));
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.0/jquery.min.js"></script>
<input type="text" name="time" value="" id="time" class="form-control" autocomplete="off" requried="1" data-endtime="" disabled="disabled">
<select name="txtSetValue">
<option value="0">One</option>
<option value="1">Two</option>
</select>
<input type="button" value="Get Value" class="get_value"/>
Now when I change the select field I can see the data is attached to endtime attribute in the browser but when i try to get it through this script then endLimit does not contains any value, but in another place same function is working there the value is not dynamic set.
jQuery(document).on('change',".get_value",function(){
var endLimit = jQuery(this).attr('data-endtime');'
});