?
Solved

wrapping code around the datepicker

Posted on 2013-05-27
3
Medium Priority
?
219 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 2000 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

Video: Liquid Web Managed WordPress Comparisons

If you run run a WordPress, you understand the potential headaches you may face when updating your plugins and themes. Do you choose to update on the fly and risk taking down your site; or do you set up a staging, keep it in sync with your live site and use that to test updates?

Question has a verified solution.

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

Introduction HyperText Transfer Protocol (http://www.ietf.org/rfc/rfc2616.txt) or "HTTP" is the underpinning of internet communication.  As a teacher of web development I have heard many questions, mostly from my younger students who have come to t…
This article discusses how to create an extensible mechanism for linked drop downs.
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)
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…
Suggested Courses
Course of the Month7 days, 20 hours left to enroll

765 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