This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Strange behaviour inside PageBuilder?

Resolved 4 replies premiumthemetheme-vantage
11 years ago · Last reply by Andrew Misplon 10 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

4
  1. Greg Priday Staff 11 years, 1 day ago

    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. Alberto VIOLA 11 years, 6 hours ago

    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. Alberto VIOLA 11 years, 6 hours ago

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

  4. Andrew Misplon Staff 10 years, 11 months ago

    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.

Have a different question or issue?

Start New Thread