datetimepicker component not in right place

后端 未结 4 1993
旧巷少年郎
旧巷少年郎 2021-01-17 08:54

I want to use datetimepicker from bootstrap so I follow manual installing guides in this site bootstrap-datetimepicker but I\'ve got following error:

相关标签:
4条回答
  • 2021-01-17 09:18

    You need a container div around of the controls

    <body>
       <div class="container">
          <div class="row">
              <div class="col-md-6">
                  your code snippet here
              </div>
          </div>
       </div>
    </body>
    
    0 讨论(0)
  • 2021-01-17 09:23

    I had the same issue too.

    I fixed it by adding a position relative to the wrapping div, like so:

    <div class="control-group form-horizontal ">
           <label class="control-label">Date</label>
                  <div class="controls" style="position: relative">
                     <input name="datetime" id="datetimepicker4" type="text"  class="span4" value="<?php echo $datetime; ?>" >
                                    </div>
                                </div>
    <script type="text/javascript">
            $(function () { 
                $('#datetimepicker4').datetimepicker();
            });
        </script>
    
    0 讨论(0)
  • 2021-01-17 09:26

    You are using bootstrap2, try to use other datetimepicker that have bootstrap2 support i.e. http://tarruda.github.io/bootstrap-datetimepicker/, it seems http://eonasdan.github.io/bootstrap-datetimepicker/ is only for bootstrap3.

    0 讨论(0)
  • I had the same issue and my workaround was add new class for my datetime control and selector for it with position: relative attribute:

    <style>
      .editor-datetime {
          position: relative;
       }
    </style>
    
    <div class="editor-datetime">
      @Html.EditorFor(i => i.StartDate)
    </div>
    

    Hope this helps!

    0 讨论(0)
提交回复
热议问题