jquery - how to set readonly to a datepicker -


i have following html table layout:

<table id="mytable"> <tbody> <tr><td rowspan="2">row text</td><td><input type="text" value="" readonly /></td><td><input type="text" value="" readonly /></td><td><input type="text" value="" readonly /></td></tr> <tr><td><input type="text" value="" /></td><td><input type="text" value="" /></td><td><input type="text" value="" /></td></tr> </tbody> </table> 

jquery datepicker attached every input fields table row input fields of first row readonly. when user selects date second row add 30days selected date , put respective input field of first row jquery below:

$('table#mytable > tbody> tr > td > input[type="text"]').datepicker({       dateformat: 'dd/mm/yy',       changemonth: true,       changeyear: true,        yearrange: '1900:2016',         onclose: function (){            var thisrow = $(this).closest('tr');            var thiscell = $(this).closest('td').index();            var thisdate = $(this).datepicker('getdate');            thisdate.setdate(thisdate.getdate() + 30);           thisrow.prev().find('td:eq(' + (thiscell + 1) + ') input[type="text"]').datepicker('setdate', thisdate);         }); }); 

i facing 2 problems here.

1) want set datepicker of input of first row in way not open datepicker on click (it used display date+30days selected second row). i.e, datepickers of first row readonly.

2) whether above code

thisrow.prev().find('td:eq(' + (thiscell + 1) + ') input[type="text"]').datepicker('setdate', thisdate);

is effective adding 30days selected date , display date in respective input field of first row?

any appreciated.

$('.datepicker').datepicker('disable'); 

where .datepicker class of datepicker.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -