1

I've got protect_javascript set to no, here's what I'm trying to do...I'm trying to insert a proform form (blog subscribe) after the 2nd paragraph in every blog post. I've got this:

<script>
 $( ".blogbody p:nth-child(3)" ).after( "{exp:proform:simple form='blog_subscribe' thank_you_url='/page/thank-you-for-signing-up'}" );
 </script>

However, it renders immediately in the footer (where the script is) and breaks the javascript. Anyone have a clue how to fix this?

1
  • When you view source is the script rendered as expected? Commented Sep 4, 2014 at 0:34

1 Answer 1

1

This won't work because you're rendering an EE form with the DOM - EE needs to parse those {exp:..} tags in order to generate an HTML form that will work. You'd be better off generating the form in the EE template and hiding/showing it using javascript/css.

3
  • I'm not trying to hide/show it. I'm trying to insert it after the third paragraph tag found. It's dynamic content so I can't do it via the source. Are you talking about generating the form and using jquery to append it afterwards? Commented Sep 4, 2014 at 14:45
  • Ahh, thanks, that worked. I generated the form and appended it to a div I inserted where I needed it. Commented Sep 4, 2014 at 14:55
  • Yay! Glad you got it working Commented Sep 4, 2014 at 15:01

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.