.php file is replacing the closing '
with ‘
in output HTML.
<?php
$foo = 'bar';
?>
<div x-data="{
foo: '<?php echo $foo ; ?>',
init(){
console.log(this.foo)
console.log('>')
}
}">
<p x-text="foo"></p>
</div>
Page Source
<div x-data="{
foo: 'bar',
init(){
console.log(this.foo)
console.log('>‘)
}
}”>
<p x-text="foo"></p>
</div></div>
Inspector
<div x-data="{
foo: 'bar',
init(){
console.log(this.foo)
console.log('>‘)
}
}”>
<p x-text=" foo"=""><p></p>
</div>
If I replace >
with something else it works as expected
This is for a WordPress site using Timber/Twig & ACF blocks
Editor: VS Code
Via Active questions tagged javascript - Stack Overflow https://ift.tt/rmVtDCE
Comments
Post a Comment