Alessandro
Alessandro

Reputation: 57

Remove quotes in a javascript code

I have this code:

    var termsAccept = '';
        <?php if($wpmailup['termsConfirm'] == 'yes'): ?>
        if(jQ('#terms-confirm').is(':checked') == false)
        {

            jQ('#show-response').html('per favore, conferma di aver letto l'informativa');
            viewInfoIcon('info');
            return false;
        }
        else
        {
            termsAccept = jQ('#terms-confirm').val();
        }
        <?php else: ?>
        termsAccept = 'yes';
        <?php endif; ?>

Actually my error is a syntax error in this line: .html('per favore, conferma di aver letto l'informativa');

My question is: How can I solve this syntax error?

Upvotes: 1

Views: 74

Answers (3)

Alessandro
Alessandro

Reputation: 57

Thanks fo all, I resolve this problem whit double quotes

Upvotes: 0

Sinan Samet
Sinan Samet

Reputation: 6752

You could use double quotes so you won't escape with single quotes:

jQ('#show-response').html("per favore, conferma di aver letto l'informativa");

Although I would recommend the solution of Adam

Upvotes: 1

Adam
Adam

Reputation: 1985

 jQ('#show-response').html('per favore, conferma di aver letto l\'informativa');

You need to escape the '

Upvotes: 1

Related Questions