Solved

jQuery UI DatePicker: How to Add Button TRIGGER SCRIPT

Posted on 2010-11-26
3
548 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

This article outlines the process to identify and resolve account lockout in an Active Directory environment.
Google always has something new and amazing up its sleeve, and the most current thing that they have been working on is another step in the evolution of Google Search, from machine learning to its brilliant successor, deep learning.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

778 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