I want to use a php boolean variable inside a jquery if-statement. This is my code:
if(<?php echo $show_login_error ?>)
$(".login_error").show();
.login_error is a class for a span element. If the $show_login_error variable is true, then I want to show the span, if not then hide it. By default the span is hidden and $show_login_error is false. Unforunately, the span shows regardless of the variable value so I'm guessing my code is wrong. What should I change to make it right? Thanks
ifin the PHP and have it print the$('.login_error').show()iftrue.0and where you have done chnages in order to show it make chnage to 1 and then after have this condition.