Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

jQuery UI DatePicker: How to Add Button TRIGGER SCRIPT

Posted on 2010-11-26
3
Medium Priority
?
557 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
Aerodynamic noise is the cause of the majority of the noise produced by helicopters. The inordinate amount of noise helicopters produce is a major problem in the both a military and civilian setting. To remedy this problem the use of an aerogel coat…
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …

926 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