I'm getting the Uncaught SyntaxError: Unexpected string error in my JavaScript and I honestly can't figure out what's wrong with the code. I have looked at the similar questions, but I'm unable to find a solution. The error is coming in the line highlighted with an asterisk below.
$("#items1").change(function () {
if ($(this).data('options') === undefined) {
$(this).data('options', $('#items2 option').clone());
}
var checkval = $(this).val();
/* this line: */ var options = $(this).data('options').filter('[value='"+ checkval +"']');
$('#items2').html(options);
});
The code is taken from Use jQuery to change a second select list based on the first select list option
I've added the extra quotes around the checkval to get rid of another error, this might be the problem, but if I change it, the other error returns.