jquery - Bootstrap datepicker options not working -


i have form field date , i'm using datepicker that. form field:

<div class=form-group>   <div class="input-group date" data-provide="datepicker">     <input class="form-control" id="data" name="data" placeholder="vvvv/mm/dd" type="text" />     <div class="input-group-addon">       <span class="glyphicon glyphicon-calendar"></span>     </div>   </div> </div> 

these options have provided not being applied:

$('#data').datepicker({   format: "yyyy/mm/dd",   todayhighlight: true,   autoclose: true,   clearbtn: true }); 

this jquery code inside $(document).ready() function in external javascript file, included right before closing </body> tag.

in jquery targeting id of <input/> element. if target input's parent element, bootstrap datepicker work.

try running code snippet or check out codepen demo:

$(document).ready(function() {    $("#datepicker-group").datepicker({      format: "yyyy/mm/dd",      todayhighlight: true,      autoclose: true,      clearbtn: true    });  });
<link href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />  <link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/css/datepicker.css" rel="stylesheet" />    <div class="form-group">    <div id="datepicker-group" class="input-group date" data-date-format="mm-dd-yyyy">      <input class="form-control" name="data" type="text" placeholder="yyyy/mm/dd" />      <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>    </div>  </div>      <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>  <script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.3.0/js/bootstrap-datepicker.js"></script>


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -