简体   繁体   中英

Change bootstrap datetimepicker in a PHP application

In a PHP application, There is this code to show the datetimepicker:

return '
        <div class="input-group input-medium date datetimepicker">' .
          input_tag('fields[' . $field['id'] . ']',$value,array('class'=>'form-control fieldtype_input_datetime'. ($field['is_required']==1 ? ' required':''))) .
          '<span class="input-group-btn">
            <button class="btn btn-default date-set" type="button"><i class="fa fa-calendar"></i></button>
          </span>
        </div>';

The datepicker is:

https://github.com/eternicode/bootstrap-datepicker

And i have another datetimepicker which is Jalali Persian bootstrap datetimepicker. I uploaded it here:

http://www.freeuploadsite.com/do.php?id=83102

And this code place the datepicker:

<div class="input-group">
                <div class="input-group-addon" data-mddatetimepicker="true" data-trigger="click" data-targetselector="#exampleInput3">
                    <span class="glyphicon glyphicon-calendar"></span>
                </div>
                <input type="text" class="form-control" id="exampleInput3" placeholder="تاریخ" data-mddatetimepicker="true" data-placement="right" data-englishnumber="true" />
            </div>

But it doesn't work in the app. I just replace the above code with the below. It shows the button and the text area but when i click nothing shows. I checked... The js and css loads correctly. Is the way I'm doing it wrong?

Did you have initialized the plugin somewhere? I can not see it

$('#exampleInput3').datepicker()

I imagine you want to attach it to the 'exampleInput3' but you can choose any other selector.

In this way you say to the plugin to which element the datepicker has to be applied to.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM