Solved

wrapping code around the datepicker

Posted on 2013-05-27
3
216 Views
Last Modified: 2013-05-28
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>
  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
  <script>
  $(function() {
    $( "#datepicker" ).datepicker();
  });
  </script>

<p>Date: <input type="text" id="datepicker" /></p>

Open in new window


do I put code around this code


for example user selects day 7 of month

and dropdown select menu
1
2
3
4
5
6
7

if user selects 3
1
2
3
0
Comment
Question by:rgb192
  • 2
3 Comments
 
LVL 44

Expert Comment

by:Rainer Jeschor
ID: 39199542
Hi,
try this please:
http://jsbin.com/umecuw/1/

HTH
Rainer
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
ID: 39199581
And here the code:
HTML
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
  <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />

  <script src="http://code.jquery.com/jquery-1.9.1.js"></script>

  <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<title>Dynamic Select</title>
</head>
<body>
  <p>Date: <input type="text" id="datepicker" />
  </p>
  <select id="dynamicSelect"></select>
</body>
</html>

Open in new window

Javascript:
$(document).ready(function () {
   $("#datepicker").datepicker(
     {
       onSelect: function(dateText, inst){
         var selectedDate = new Date(dateText);
         var selectedDay = selectedDate.getUTCDate() + 1;
         SetDynamicSelect(selectedDay);
         alert(selectedDay);
       }
     });
});

function SetDynamicSelect(noOfSelects) {
  $("#dynamicSelect").find('option').remove();
  $("#dynamicSelect").append('<option>Please select</option>');
  for (var i=1;i<=noOfSelects;i++)
  {
    $("#dynamicSelect").append('<option value="' + i + '">' + i + '</option>');
  }
}

Open in new window

0
 

Author Closing Comment

by:rgb192
ID: 39202867
calendar works
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Introduction Got endorsements from your clients?  Great!  There is almost nothing better than word-of-mouth advertising.  But how can you do that on the internet?  Sure you can make a page for endorsement quotations and list them all, but who is …
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

856 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