0

I am struggling with this.

I wanted to use a jQuery & Java Script to find words and then put html tags around them. I found that idea here:

Find text string in jQuery and make it bold

and

http://jsbin.com/AvUcElo/1/edit

I was able to use the second link to work on my Wordpress site. However, I have a contact form on my site and the contact form is broken when I call the java script. I'm using the Wordpress plugin "Contact For 7".

When the contact form is work it looks like this:

<p>Your Name (required)<br>
    <span class="wpcf7-form-control-wrap your-name"><input type="text" name="your-name" size="40" class="wpcf7-form-control wpcf7-text wpcf7-validates-as-required" aria-required="true" aria-invalid="false"></span>
</p>

When I call the javascript form the second example the code looks like this:

<p>Your Name (required)
</p>

Any suggestions why this is happening would be very helpful.

Community
  • 1
  • 1
  • That plugin in your jsbin example will actually remove any HTML within the selection you call it on, as it does `.text()` on it. Not sure what you call `.wrapInTag` on, but you should probably more specific than you currently are (`$('body').wrapInTag();` -> `$('.text-block').wrapInTag();`). – christian314159 Jul 29 '14 at 03:01
  • I edit the `('body')` and put in a specific class `('.post-content p')`, and it works fine now. I am so excited. I was worried I would have to call the class every time I needed it. Thank you so much for your help @christian314159. – Salvatore_C Jul 31 '14 at 16:31

0 Answers0