jquery mobile - jquerymobile datebox - How to call a function when date selected -


i have inherited code using jquerymobile datebox. code far concentrates on making application correct. need make work when date selected, server called date , new page loaded. examples change date in page.

the code far :-

$('#daycal').live('click', function() {   $('#catchdate').datebox('open'); });  $( "#catchdate" ).bind( "change", function(event, ui) {   $("#test1").val("xyz"); }); 

and

<div data-role="fieldcontain">   <label for="catchdate">some date</label>   <input name="catchdate" type="date" data-role="datebox" id="catchdate" data-options='{"mode":"calbox", "usenewstyle":true, "theme":true, "themeheader":"f", "themedatehigh":"f", "themedatepick":"e", "themedate":"f", "centerhoriz":true}' />   <input id="test1" type="text"/> <!-- later changed function call --> </div> 

in simple test expected text in input change when date selected.

i have seen example using bind change event, cannot work. in example changing value in input element, later changed function call.

i saw somewhere in search answer, comment 'live' deprecated.

finally, thought use closecallback ('callbacks ('opencallback' , 'closecallback') simple work with...') not find examples of how should used.

what changes need make obtain functionality need?

you try using close function of date box, when user changes date selection makes , closes date box can call server method selected date:

$('#dateselectorid').bind('datebox', function (e, passed) {      if ( passed.method === 'close' ) {           // selected date         var date = $('#dateselectorid').val();                   // make service method , change page page     } }); 

Comments

Popular posts from this blog

How to mention the localhost in android -

php - Calling a template part from a post -