Created
January 2, 2014 06:43
-
-
Save natsu90/8215771 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function add_new_option() { | |
$('#calendarbyuser').select2('container').select2('close'); | |
// add random value | |
var today = new Date(); | |
var new_option_val = today.getTime(); | |
var new_option_name = prompt("Please enter your option","New Option "+today.getSeconds()); | |
if(new_option_name != null) | |
{ | |
$('#calendarbyuser').append('<option value='+new_option_val+'>'+new_option_name+'</option>'); | |
$('#calendarbyuser').select2('val', new_option_val); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment