$('.im_not_available').click(function (e) {
e.preventDefault(); // user has clicked "I'm not available" in one of the availability rows
var availability_row = $(this).closest('.availability_row'); //select the row
// var availability_date = availability_row.attr('id'); // get the date
var availability_span = availability_row.children('span');
if (availability_span.hasClass("red")) { // we already have no elements in this array
return; // ignore click
} else {
var availability_date = availability_row.children('span').text();
var proceed = confirm('Are you sure you want to remove all availability on ' + availability_date + ' ?');
if (proceed) {
remove_availability(availability_row);
}
}
})
$('.im_available').click(function (e) { // user has clicked "I'm available" in one of the availability rows
e.preventDefault();
var availability_row = $(this).closest('.availability_row'); //select the row
// var availability_date = availability_row.attr('id'); // get the date
if (availability_row.children('span').hasClass("green")) { // we already have elements in this array
return; // ignore click
} else {
append_availability(availability_row);
}
})
function remove_availability(availability_row) {
var availability_date = availability_row.attr('id'); // get the date
var request = {
"request": 'remove_availability',
"change_date": availability_date
};
send_availability_request(request);
//todo remove the html elements
}
function append_availability(availability_row) {
var availability_date = availability_row.attr('id'); // get the date
var from_id = availability_date + '_from_1';
var to_id = availability_date + '_to_1';
var append_html = '<div class="availability_row_date" id=""><div class="availability_row_date_row clearfix"><div class="availability_row_date_from"><div...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.