0

I have 2 datepickers in my web page and somehow one continue the other. I want them to work differently. Maybe its because of the object dateText but don't know how to clean it.

There are two scripts calling the same class

<script src="js/jquery.min.js"></script>
<script src="js/jquery-ui.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.10.3.custom.css">
<script src="js/jquery.datepicker.extension.range.min.js"></script>

<script>
$(function() {
    $('#date_range').datepicker({
        range: 'multiple',
        onSelect: function(dateText, inst, extensionRange) {    
            $('#dataF').val(extensionRange.datesText.join(','));
            $('#date_range').val('DATA');
            $('#datepicker').datepicker('selected','');
        }
    });
});
$("#date_range2").click(function(){
    $('#date_range2').val(" ").datepicker({startDate: "+7d"});                  
});
</script>
<script>
$(function() {
    $('#date_range2').datepicker({
        range: 'multiple',
        onSelect: function(dateText, inst, extensionRange) {
            $('#dataS').val(extensionRange.datesText.join(','));
            $('#date_range2').val('TILL');
        }
    });
});
</script>

Then I have

<input id="date_range" value="DATA:" />

<input name="dataF" id="dataF" type="text" size="50" /> 

<input id="date_range2" value="TILL:" />

<input  name="dataS" id="dataS" type="text" size="50" /> 
Xpleria
  • 5,472
  • 5
  • 52
  • 66
Yan.D
  • 79
  • 9
  • Does one over write the other both of them do the same thing ? did you read [this](https://stackoverflow.com/questions/4900101/jquery-ui-multiple-datepickers-on-single-page) – S4NDM4N Oct 09 '17 at 11:17
  • Hope this link can help you [enter link description here](https://stackoverflow.com/questions/16373734/jquery-datepicker-restrict-dates-in-second-date-field-based-on-selected-date-in) – Hari Prasad Oct 09 '17 at 12:10
  • no.. my friend they have to work separately! one is for when trip starts second is when trip ends if same day soo its trip if not its tour ! somehow the second gives the dates that the first one give ! – Yan.D Oct 09 '17 at 17:25

1 Answers1

0

Just try this sollution example link http://jsfiddle.net/fMD62/

<input type="text" id="datepicker1" name="datepicker1" value="" />
<input type="text" id="datepicker2" name="datepicker2" value="" />


$(function() {
    $("#datepicker1").datepicker();
    $("#datepicker2").datepicker();
});
Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125
Er Nilay Parekh
  • 569
  • 5
  • 17