0

I am having to hook into a plugin and I need to actually output a value I get via jQuery. However, when I try to return it (I have to use return) it just escapes the javascript instead of actually giving me the value. So, the output on the screen is literally the text instead of the value ie: <script>document.write(buttontext);</script> instead of some value

<script>
var myValue = jQuery( '.my_value' ).val();
<?php 
     $myValue ="<script>document.write(myValue);</script>";             
 ?>
</script>
<?php
//.... some code.. $myValue ends up in $content which I return below
return $content;
?>
2
  • What hook are you using?
    – Himad
    May 23 '20 at 0:23
  • WP Forms smart tag
    – Iggy's Pop
    May 23 '20 at 11:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.