Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

wrapping code around the datepicker

Posted on 2013-05-27
3
Medium Priority
?
221 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

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

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

Hi all! Recently there was EE question and the person wanted to have a multi-column textbox <div> selection, so as a first step to answer I provided a link but that was not complete with JavaScript selection, but had a good style sheet. So as a ques…
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…
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)
Suggested Courses

618 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