×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

How to have several datepickers on same HTML page

How to have several datepickers on same HTML page

How to have several datepickers on same HTML page

(OP)
During this lockdown period I have decided to help a local sports charity by finishing-off an online management system written using, primarily bootstrap 4 and php.

One thing I want to do is a system to set up dates that sessions will be available for forthcoming term. So I set up a form with 6 inputs, one for each day Mon - Sat. I have then looked for a data picker add-in that allows multi dates to be picked. I came across 2 jquery ones that should work: Bootstrap-Datepicker that doesn't seem to work with Bootstrap 4 and Tempusdominus which I am trying to use.

Being completely new to, and not understanding javascript/jquery, I cannot see how to have more than one such datepicker on a single page.

I have used the code for Tempusdominus as on their examples page, but don't understand how to link a separate datepicker to each input.

For each edit/picker the code is:

CODE --> HTML

<label class="col-md-2 control-label" for="monclasses">Monday:</label>  
                                <div class="col-md-9">
                                    <div class="input-group date" id="datetimepicker14" data-target-input="monclasses">
                                        <input id="monclasses" type="text" class="form-control datetimepicker-input" data-target="#datetimepicker14"/>
                                        <div class="input-group-append" data-target="#datetimepicker14" data-toggle="datetimepicker">
                                            <div class="input-group-text"><i class="fa fa-calendar"></i></div>
                                        </div>
                                    </div>
                                </div>
                                <div class="col-md-1"></div> 
The only difference, at the moment, is that each day input has a different id ("monclasses" in the above example)

CODE --> Javascript/Jquery

<script type="text/javascript">
            $(function () {
                $('#datetimepicker14').datetimepicker({
                    allowMultidate: true,
                    multidateSeparator: ','
                });
            });
        </script> 

Any help thankfully received!

RE: How to have several datepickers on same HTML page

(OP)
Finally found a completely different way of doing this so please ignore this question

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close