USING JAVASCRIPT
function toggleCheckbox() { //moved function to global scope, if you wanted to add the listner inline you'd do it this way.
if($("#toggle").is(':checked')) {
SurveyAppear();
} else {
SurveyDisappear();
}
}
var SurveyAppear = function() {
$("#surveyButton").prop('value', 'Open'); //switched from Close
$("#toggle").prop('checked', false); //changed to false
}
var SurveyDisappear = function() {
$("#surveyButton").prop('value', 'Close'); //switched from Open
$("#toggle").prop('checked', true);
}
document.getElementById("surveyButton").addEventListener("click", toggleCheckbox, false);