it’s me again 🙂
Some helpful members helped me get a script working, but I ran into a brick wall with a case that I also want to have an IF statement. It looks like this:
$(document).ready(function() {
$("input[type='button']").click(function() {
switch(this.id) {
case:'buttonone':
if( $('#one').attr('readonly')) {
$("#changeone").attr('value', 'Save');
$('#one').attr('readonly', false);
$('#one').addClass('focusField');
$("#questiononetext").html("When do you want to go out?");
} else {
$("#changeone").attr('value', 'Change');
$('#one').attr('readonly', true);
$('#one').removeClass('focusField');
$("#questiononetext").html("Date: ");
} break;
case 'buttontwo': $("#questiononetext").html("Content changed"); break;
case 'buttonthree': $("#content").html("Content changed again"); break;
}
});
});
Notice what comes after CASE: buttonone, I tried an if statement and that broke the whole script. Does anyone have any ideas as to why this happens? Thank you :)))
Not sure is it the extra colon after the “case” in “case: buttonone”. Please check