Home>Support>Strange behaviour inside PageBuilder?

Strange behaviour inside PageBuilder?

Greetings ,

I have a strange question & problem but I am not sure if it depends on the Theme (Vantage Premium) and PlugIn (PageBuilder 2.x) and widget (Text) I am using.

Briefly, I have a JQuery simple routine inside a Text Widget that append selected string to a TextArea inside a form (I use Contact Form 7 PlugIn). I can have more string selected that will be inside the textarea and I’d like to have them separated be a new line. Here it is:

$(document).ready(function() {
 $("td#TDSerrPrd1").click(function()   {
     var str = $( this ).text();
     $("#PrdSelected").append ('n'' + str );
  });
});

The problem is that after saving the page the code is changed in this way:

$(document).ready(function() {
    ....;
    .... ;
     $("#PrdSelected").append ( ''n'' + str );
                                                            ^^
  });
});

with the backslash disappeared and with the consequence that I have no new line appended between the strings in the textarea.

Of course, the same code tested locally works fine.

Any help is really greatly appreciated.

Best regards,
Alberto Viola

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 7 months ago Greg Priday
    Hi, I Work Here

    Hi Alberto

    Just to confirm what’s going on here – are you adding that code to the actual text widget?

    There is a lot of sanitization and encoding that happens in a text widget, so it’s likely going to cause problems adding javascript to this widget. I’d recommend using a plugin like this instead.

    https://wordpress.org/plugins/css-javascript-toolbox/

  2. 9 years, 7 months ago Alberto VIOLA

    Hi,

    I have fixed my problem in this way:

    <script

    $(document).ready(function() {
    $(“td#TDSerrPrd1”).click(function()
    { var str = $( this ).text();
    var crlf = “ ”
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
    $(“#PrdSelected”).append( crlf + str );
    });
    });

    Now I can get a list of itmes in my each of them separated by a new line feed.
    This code is at the end of my html code inside a text widget.

    Best regards,
    Alberto Viola

  3. 9 years, 7 months ago Alberto VIOLA

    Sorry the crlf is = to & # 0 1 3 ; & # 0 1 0 ; (no diplayed before)

  4. 9 years, 6 months ago Andrew Misplon
    Hi, I Work Here

    Hi Alberto

    Really glad to hear you’ve been able to resolve. Thanks for sharing your solution here.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More