0
I’m trying to play a value redeemed by php and play in a input with JQuery and then perform a Ubmit on a certain form, what I tried to do is this here:
if (!empty($_POST['Termo'])) {
$Termo = $_POST['Termo'];
echo "
jQuery(function($) {
document.querySelector('[name='Termo']').value = '" . $Termo . "';
document.forms['frmBusca'].submit();
});
";
}
The input is named after Termo but nothing happens when receiving the variable Termo I check and it has content.
Because there’s a ternary inside the
if?– William Aparecido Brandino
Why don’t you echo into the input HTML? instead of setting with Javascript an element that is generated in PHP as well
– Sergio