Solved

wrapping code around the datepicker

Posted on 2013-05-27
3
213 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
Comment Utility
Hi,
try this please:
http://jsbin.com/umecuw/1/

HTH
Rainer
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 500 total points
Comment Utility
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
Comment Utility
calendar works
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Summernote required 3 56
coldfusion, jQuery help 25 64
jQuery Conflict 27 46
jQuery Animate Left Right 2 43
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…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now