Question

<input type="text" id="date-range1" class="embed width230 teaxtboxCal " style="display: none;">

i want to get the value in the text box whenever there is change . Actually the value is created when the calendr pop up close. how can i get the onchange function work on hidden text field.

update: i had called the trigger change in the datepicker closeDatePicker() and then i was able to use onchange function. Thanks,

 function closeDatePicker()
        {
            $('#date-range1').trigger('change');
            //some code //
        }

my only concern is i am using the id '#date-range1', but i wish there was something that triggers for all id where this is used.

anyways thanks everyone

Was it helpful?

Solution

$(document).ready(function(){
     $('#date-range1').on('change',function(){

           alert($(this).val());
      });

});

this is how to do it in jquery. or just use .bind

OTHER TIPS

You can bind your input box with the change event

 $("#date-range1").bind("change",traceChange);


 function traceChange(){
      // logic comes here
 }

you can write onchange event for textbox..

<input type="text" id="date-range1" class="embed width230 teaxtboxCal " style="display: none;" onchange="abc();return false">

Javascript

<script type = "text/javascript" >
        function abc() {
           //Do whatever you need here
        }
</script>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top