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?

  • When you view source is the script rendered as expected? – AllInOne Sep 4 '14 at 0:34
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.

| improve this answer | |
  • 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? – nick Sep 4 '14 at 14:45
  • Ahh, thanks, that worked. I generated the form and appended it to a div I inserted where I needed it. – nick Sep 4 '14 at 14:55
  • Yay! Glad you got it working – BellamyStudio Sep 4 '14 at 15:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.