Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
jquery load javascript
Old 09-20-2011, 05:29 PM jquery load javascript
Red_X_'s Avatar
Extreme Talker

Posts: 158
Location: Houston
Trades: 0
I have a select drop list. When a option is selected it grabs a corresponding function. In this case, if the the option 'date range' or value="dr" - I have the script load two more pages.
/date.js
/date2.js

Which contains the corresponding functions for loading selecting a date from a small menu.

Due to where the script is located I am not allowed to share it. But what I can do, is upload some screenshots.

Here is the code:

Code:
$("#details").live("change", function() {
				var selected = $("#details option:selected");
				var output = "";
				if(selected.val() == 'dr') {
				$.get('script/date.js');
				$.get('script/date2.js', function() {
						$(function()
							{
								$('.date-pick').datePicker({startDate:'01/01/1996'});
							});
				});
					output = '<label for="date1">Date Ordered</label><input name="date1" id="date1" onFocus="searchDate();" class="date-pick dp-applied" /> to <input name="date3" id="date3" onFocus="searchDate();" class="date-pick dp-applied" /><label for="date2">Date Shipped</label><input name="date2" id="date2" onFocus="searchDate();" class="date-pick dp-applied" /> to <input name="date4" id="date4" onFocus="searchDate();" class="date-pick dp-applied" />';
				} else {
					if(selected.val() == 's') {
						output = '<label for="status">Status</label><select id="status2" name="stat"><option>---Select Status---</option><option value="p">Pending</option><option value="ship">Shipped</option></select>';
					}
				}
				
				$("#range").html(output);
			});
Note: Seems to work fine in FF. But has issues in chrome.
Attached Images
File Type: gif shot_1_error.gif (3.7 KB, 8 views)
File Type: gif shot_2_correct.gif (5.1 KB, 7 views)
__________________
"Good News Everyone, by reading this your hearing my voice."

Last edited by Red_X_; 09-20-2011 at 06:13 PM..
Red_X_ is offline
Reply With Quote
View Public Profile Visit Red_X_'s homepage!
 
 
Register now for full access!
Reply     « Reply to jquery load javascript
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.15856 seconds with 13 queries