Solved

wrapping code around the datepicker

Posted on 2013-05-27
3
217 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
In this article you'll learn how to use Ajax calls within your CodeIgniter application. To explain this, I'll illustrate how to implement a simple contact form to allow visitors to send you an email through your web site.
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…

733 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