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

var myValue = jQuery( '.my_value' ).val();
     $myValue ="<script>document.write(myValue);</script>";             
//.... some code.. $myValue ends up in $content which I return below
return $content;
  • 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.