Home > Article > Backend Development > Why is my font color not working in this PHP script?
A PHP code is provided:
echo "<script>$('#edit_errors').html('<h3/><em/>Please Correct Errors Before Proceeding</h3>')</script>";
The user seeks to add a font color to the text. However, upon attempting the following:
echo "<script>$('#edit_errors').html('<h3/><em/><font color=\"red\">Please Correct Errors Before Proceeding</h3>')</script>";
The word "red" appears in black, and the compiler generates an error. Single quotes unsuccessfully hide the text.
Double quotes are misinterpreted as the string's end. To escape this, use backslash () to escape the quotation mark:
echo "<script>$('#edit_errors').html('<h3/><em/><font color=\"red\">Please Correct Errors Before Proceeding</h3>')</script>";
Consult the documentation for further information on strings and escape sequences.
The above is the detailed content of Why is my font color not working in this PHP script?. For more information, please follow other related articles on the PHP Chinese website!