help with javacript and php
-
Hello: I am trying to have a javascript thing where they press one button and one button from shortcode appears, and press another button and a second button appears; i have tested it all up to this point:
I have gotten the javascript to work with the two buttons; and it switches text when you toggle between the two buttons; and I am using php to “echo” the text on the two options…so – I thought I should be able to just “echo do shortcode” and have the two shortcode buttons load on page instead of just echoing text…
but i cannot get the shortcodes to work…
here is the script:
<script>
function myFunction1b()
{
x=document.getElementById(“cars_level2”); // Find the element
x.innerHTML = ‘<?php echo do_shortcode(‘[add_to_cart item=”e001″ ]’); ?>’;
}
</script>I dont know if you can echo do_shortcode in this code this way; but I am hoping; I am sure my coding is wrong; can anyone help with this? thanks…
- The topic ‘help with javacript and php’ is closed to new replies.