×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Javascript Conflicting error on wordpress website

Javascript Conflicting error on wordpress website

Javascript Conflicting error on wordpress website

(OP)
Dear support community!

I am wondering if anyone may know a quick fix to this issue.
Right now while applying a single java script to a WordPress block its working fine.

Once adding a second widget with similar code then it’s causing some type of conflict with the first one.. perhaps this may be because they are using the same name or sharing some type of information.

I’ll post both code snippets below & you may know a way to completely separate them so they do not recognize each-other and conflict.

These are “buy now” Java script buttons from Xsolla & they each have different values, i need to add a total of 10 – 12 but right now I cannot add more then one without some type of conflict.

Code 1:
<div id=”XS-pay2play-widget”></div> <script> var options = { access_token: “9upbu4RrjLChk8PgP42n5LqSmqANijKY”, theme : { foreground: “green”, background: “dark” }, lightbox: { height: “700px”, spinner: “round” }, target_element: “#XS-pay2play-widget” }; var s = document.createElement(“script”); s.type = “text/javascript”; s.async = true; s.src = “https://cdn.xsolla.net/embed/pay2play/2.3.0/widget...”; s.addEventListener(“load”, function (e) { var widgetInstance = XPay2PlayWidget.create(options); }, false); var head = document.getElementsByTagName(“head”)[0]; head.appendChild(s); </script>

Code 2:
<div id=”XS-pay2play-widget”></div> <script> var options = { access_token: “9upbGoqnbonvXqyfgaBtsDcyWnv0FXEe”, theme : { foreground: “green”, background: “dark” }, lightbox: { height: “700px”, spinner: “round” }, target_element: “#XS-pay2play-widget” }; var s = document.createElement(“script”); s.type = “text/javascript”; s.async = true; s.src = “https://cdn.xsolla.net/embed/pay2play/2.3.0/widget...”; s.addEventListener(“load”, function (e) { var widgetInstance = XPay2PlayWidget.create(options); }, false); var head = document.getElementsByTagName(“head”)[0]; head.appendChild(s); </script>

Thanks in advance for your kind efforts

Cody.

The blog I need help with is https://www.legioneternalwar.com/crowdfunding/ You can see a buy button below and there is spouse to be a buy button for all packages but they are conflicting with eachother.

RE: Javascript Conflicting error on wordpress website


Cannot have the same id (XS-pay2play-widget) for both DIVs. The Ids must be unique to the page...


Mark

"You guys pair up in groups of three, then line up in a circle."
- Bill Peterson, a Florida State football coach

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close