I have the following input within a form:
<form>
<input type="hidden" name="hiddeninput" value="SecondProblem">
</form>
Using the script below, I'm trying to store the word "SecondProblem" using PHP echo as a variable in JQuery and then use this to hide the parent form. The PHP echo text, however, is not picked up by a variable.
$(function(){
var selectorvar = "<?php echo "SecondProblem"; ?>"
var selectorvar1=selectorvar ;
$('input[value="+selectorvar1+"]').closest("form").css("display", "none");
});
When I directly replace "+selectorvar1+"
with the text "SecondProblem"
the form display successfully switches to "none" so I know it has something to do with the PHP echo not storing as a variable.
Side note: I realize that there are simpler ways to turn the display on this form to "none" but I need to do it this way; I just removed the context so I could present my problem more directly.
Any help would be much appreciated!