jQuery(document).ready(function(){
var j = jQuery;
// validate signup form on keyup and submit
j("#new-dedication-form").validate({
ignore: [],
messages: {
friend_ids: "Please enter at least one member."
}
});
var onAutocompleteSelect = function(value, data) {
j('#selection').html('
' + value);
alert(data);
}
var options = {
minLength: 1,
serviceUrl: ajaxurl,
width: 300,
delimiter: /(,|;)\s*/,
onSelect: ia_on_autocomplete_select,
deferRequestBy: 0, //miliseconds
params: {
action: 'bp_dedication_autocomplete_ajax_handler'
},
noCache: true //set to true, to disable caching
};
j("#dedicate_to_input").autocomplete(options);
var url = '';
j('#video_url').change(function(){
// Check for empty input field
if(j('#video_url').val() != ''){
// Get youtube video's thumbnail url
// using jYoutube jQuery plugin
url = j.jYoutube(j('#video_url').val());
// Now append this image to