Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9048627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T12:12:03+00:00 2026-06-16T12:12:03+00:00

Hello all Javascript and Widget Experts . I am scratching my head for the

  • 0

Hello all Javascript and Widget Experts .

I am scratching my head for the last two days trying to figure out how to enable my widget so it can be included on the same page twice .

Here is what I have done

1.driver.js ( Loads all the required )
Loading the jquery , jquery-ui, wdcreate.js, set tabs.js via document.write calls .

2.wdcreate.js ( creates the tab lists and content )
Nothing complex , just a ui and li lists to create 3 tabs content assigned to wHTML
and then conent loaded via

document.getElementById(tabid+"_mywidget_container").innerHTML = wHTML;

3.settabs.js ( Ideally supposed to enable tabs ) has just one line to load the tab container

$(document).ready(function() {$( "#"+tabid+"_mywidget_container" ).tabs();});

4.index.html – ( test page that includes the widgets )
This page just has two widgets included

<script type='text/javascript'> 
    var tabid='001';
    document.write('<scr'+'ipt type="text/JavaScript" src="http://localhost:8080/demo/driver.js"></scr'+'ipt>'); 
    </script>
    <div id="001_mywidget_container"></div>

<script type='text/javascript'> 
var tabid='002';
document.write('<scr'+'ipt type="text/JavaScript" src="http://localhost:8080/demo/driver.js"></scr'+'ipt>'); 
</script>
<div id="002_mywidget_container"></div>

Now the issue is the tabs are rendered if I include only one widget in my index.html file , if I include two or three for that matter , It fails ..

Any suggestions or what Is it I have to do ? I have tried searching and to isolate the issue put together this small project , originally was using plain javascript and reverted to jQuery ( I am not an expert Javascript programmer). Realize that this has to do something with the window.onLoad

Also note that in the settabs , instead of assigning the tabid dynamically , if I use two calls one for each tabwidget id , it loads two tab containers ..

one can have multiple widgets on a single page ex one tab container to show information for one topic , another tabcontainer for another topic etc.. so a user looking to have a page which can show information on 6 topics will include 6 widgets/tabcontainers on the same page …

Appreciate all your help.
Thanks again.

Also here are the pages

http://www.werindia.com/demo/index1.html - widget included one time
http://www.werindia.com/demo/index2.html - widget included two times. in reality this could be any non zero number 

http://www.werindia.com/demo/driver.js
http://www.werindia.com/demo/wdcreate.js
http://www.werindia.com/demo/settabs.js

This is the page with static containers — but in reality these would be dynamic

http://www.werindia.com/demo/index3.html
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T12:12:10+00:00Added an answer on June 16, 2026 at 12:12 pm

    Well, offhand the following things make no sense.

    • You’ve mashed implementation code and your dependencies into a single file and you’re loading/executing all of it twice.

    • You’re not merely linking via script tags twice. For some reason you felt compelled to use document.write

    • It’s 2012 and you’re using document.write

    • You have some common tabs functionality you want to hit two div containers and for some reason you’re using IDs instead of a class. It looks like IDs might establish what tabs get built in your tabs.js but I can only assume since you’re not showing that code.

    We do not reappend script tags to make the same thing happen twice in JavaScript. We fire functions twice. Or we fire the right function at a more general category of DOM elements.

    If the following is all it takes to build tabs in those containers:

    $(document).ready(function() {$( "#"+tabid+"_mywidget_container" ).tabs();});
    

    then this would make a lot more sense:

    $(document).ready(function() {$( ".tab_container" ).tabs();});
    

    If you don’t know what needs to be in your HTML in order for .tab_container to work, I think you need to put all of this down and learn the basics more in-depth than you do. Try to keep your JS completely separated from the HTML. Link your files once at the bottom of the page. Learn the DOM API or at least how jQuery works. Try to think of JS as acting on HTML rather than simply writing it as it parses.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hello I'm just trying to figure out the concept of this example menu http://www.cdrking.com
Hello all I am working on javascript jquery and svg.I want to ask a
Hello all I am working in javascript and html5.I want to ask that how
Hello all I am working on html and javascript.And I am going to ask
Hello all how can I create jar file of my project that is created
I am trying to call a javascript function from php. According to all of
Currently using Telerik ASP .NET MVC Controls version 2011.2.712 Hello all, I am trying
Hello, I do not know very much about javascript, not much at all to
Hello all I am working in html5 and JavaScript and I am stuck in
Hello JavaScript guru's. I have a simple JS question on how to replace all

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.