Solved

jQuery UI DatePicker: How to Add Button TRIGGER SCRIPT

Posted on 2010-11-26
3
546 Views
Last Modified: 2012-05-10
11/27/10

Greetings Everyone;

I'm a newbie at this so please bear with me...  :)

I have a working jQuery UI DatePicker script that only
displays WED & SAT (see MAISCRIPT BELOW).

I also have a working jQuery UI DatePicker script that adds
a button image to trigger the DatePicker (see TRIGGER SCRIPT BELOW).

How can I integrate the TRIGGER SCRIPT into the MAIN SCRIPT?

I know this is simple but this newbie can't figure out out the syntax.

Thank you in advance for your time and consideration.
´*•.¸(`*•.¸?¸.•*´)¸.•*´
?*°Doris 42DoubleDDs*°•´»?
.¸.•*(¸.•*´?`*•.¸) *•.¸


<Code>

<TRIGGER SCRIPT>
      <script>
      $(function() {
            $( "#datepicker" ).datepicker({
                  showOn: "button",
                  buttonImage: "css/blitzer/images/calendar.gif",
                  buttonImageOnly: true
            });
      });
      </script>
<TRIGGER SCRIPT>


<MAIN SCRIPT>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Disable Certains Days in a Week using jQuery UI DatePicker</title>
<link rel="stylesheet" href="css/redmond/jquery-ui-1.8.6.custom.css" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.6.custom.min.js"></script>


<script type="text/javascript">
    $(function() {
        $("#datepicker").datepicker(
        { beforeShowDay: function(day) {
            var day = day.getDay();
            if (day == 0 || day == 1 || day == 2 || day == 4 || day == 5) {
                return [false, "somecssclass"]
            } else {
                return [true, "someothercssclass"]
            }
        }
        });
    });
</script>
</head>
<body>
<input id="datepicker"/>
</body>
</html>
<MAIN SCRIPT>

</Code>
0
Comment
Question by:DMackallii
  • 2
3 Comments
 
LVL 3

Accepted Solution

by:
roynaufal earned 500 total points
ID: 34221579
off top of my mind, not totally sure if the beforehowday is part of the jquery ui, but in case so,
this should work:

 <script>
      $(function() {
            $( "#datepicker" ).datepicker({
                  showOn: "button",
                  buttonImage: "css/blitzer/images/calendar.gif",
                  buttonImageOnly: true,
                  beforeShowDay: function(day) {
            var day = day.getDay();
            if (day == 0 || day == 1 || day == 2 || day == 4 || day == 5) {
                return [false, "somecssclass"]
            } else {
                return [true, "someothercssclass"]
            }
        }
            });
      });

Open in new window

0
 

Author Closing Comment

by:DMackallii
ID: 34222251
roynaufal;

Worked like a charm!

Thank-You soooo very much.

´*•.¸(`*•.¸?¸.•*´)¸.•*´
?*°Doris 42DoubleDDs*°•´»?
.¸.•*(¸.•*´?`*•.¸) *•.¸
0
 
LVL 3

Expert Comment

by:roynaufal
ID: 34222267
you're most welcome :)
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jquery helps 31 187
Jquery height() issue 13 153
jQuery, change background image on checkbox select 9 153
Need some javascript help with form event attachment 6 137
In 2017, ransomware will become so virulent and widespread that if you aren’t a victim yourself, you will know someone who is.
With the rapid rise in mobile usage, mobile devices are here to stay and have become an integral part of doing business. Here are 9 great apps for your BYOD environment.
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now