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.
__________________
"Good News Everyone, by reading this your hearing my voice."
Last edited by Red_X_; 09-20-2011 at 06:13 PM..
|