jquery datepicker range disable field -


i have 2 input fields. 1 datepicker range , other datepicker month only. want month input field (also month datepicker) become disabled if user selects date range... ive tried many things , tried searching no luck.. maybe can turn me in right direction..

in simple terms... if selects 1st input field (#daterange) want 2nd input field (#monthselect) disabled , want datepicker disabled on #monthselect

thanks

jquery datepicker:

new picker.date.range($$('input[id="daterange"]'), {         timepicker: false,         columns: 2,         format: '%y/%m/%d',         positionoffset: {x: 0, y: 0},         onselect: function(date){         $('#monthselect').attr("disabled",true);         }     });  new picker.date($$('input[id="monthselect"]'), {     positionoffset: {x: 0, y: 0},     pickonly: 'years',     pickonly: 'months',     format: '%y/%m',     usefadeinout: !browser.ie     }); 

my input fields:

<input type="text" name="daterange" id="daterange" style="width: 200px">  <input type="text" name="monthselect" id="monthselect"> 

this works me (thanks andrew donald johnson):

new picker.date.range($$('#daterange'), {         timepicker: false,         columns: 2,         format: '%y/%m/%d',         positionoffset: {x: 0, y: 0},         onselect: function(date){         document.getelementbyid("monthselect").disabled = true;              }     }); 

this code should you!

var data_01 = document.getelementbyid("daterange"); data_01.onchange = function () {    if (this.value != "") {       document.getelementbyid("monthselect").disabled = true;    } } 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -