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 7988869
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T12:34:58+00:00 2026-06-04T12:34:58+00:00

I need to append the following HTML fragment into a document, substituting a value

  • 0

I need to append the following HTML fragment into a document, substituting a value for the display_spinner param:

<script type="text/javascript" src="http://public.tableausoftware.com/javascripts/api/viz_v1.js"></script>
<div class="tableauPlaceholder" id="tableauPlaceholder" style="visibility:hidden;width:654px; height:1469px;background-image: url('http://tableau.russellchristopher.org:81/Background.gif'); top: 0px; left: 0px; width: 100%; margin-left: 76px;">
    <noscript>
        <a href="#"><img alt="Analytics, Inc. " 
                    src="http://tableau.russellchristopher.org:81/Background.gif" 
                    style="border: none" /></a>
    </noscript>
    <object class="tableauViz" width="654" height="1469" style="display:none;">
        <param name="host_url" value="http%3A%2F%2Fpublic.tableausoftware.com%2F"
        />
        <param name="site_root" value="" />
        <param name="name" value="AnalyticsIncJavaScript&#47;AnalyticsInc" />
        <param name="tabs" value="no" />
        <param name="toolbar" value="yes" />
        <param name="static_image" value="tableau.russellchristopher.org:81/Background.gif"
        />
        <param name="animate_transition" value="yes" />
        <param name="display_static_image" value="yes" />
        <param name="display_spinner" value="" id="display_spinner" />
        <param name="display_overlay" value="yes" />
        <param name="display_count" value="yes" />
    </object>
</div>

Here’s what I’ve come up with (JSFiddle here: http://jsfiddle.net/9vBGq/ )

$(document).ready(function () {
    var $placeholder = $('<div class="tableauPlaceholder" style="width:654px; height:1469px;background-image:  url("http%3A%2F%2Ftableau.russellchristopher.org:81%2FBackground.gif"); top: 0px; left: 0px; width: 100%; margin-left: 76px;"></div>'),
        $noscript = $('<noscript> <a href="#"><img alt="Analytics, Inc. " src="http%3A%2F%2Ftableau.russellchristopher.org:81/Background.gif" style="border: none" /></a></noscript>'),
        $tableauViz = $('<object class="tableauViz" width="654" height="1469"></object>'),
        $host_url = $('<param name="host_url" value="http%3A%2F%2Fpublic.tableausoftware.com%2F">'),
        $site_root = $('<param name="site_root" value="" />'),
        $sheetName = $('<param name="name" value="AnalyticsIncJavaScript&#47;AnalyticsInc" />'),
        $tabs = $('<param name="tabs" value="no" />'),
        $toolbar = $('<param name="toolbar" value="yes" />'),
        $static_image = $('<param name="static_image" value="http://tableau.russellchristopher.org:81/Background.gif"/>'),
        $animate_trasnsition = $('<param name="animate_transition" value="yes" />'),
        $display_static_image = $('<param name="display_static_image" value="yes" />'),
        $display_overlay = $('<param name="display_overlay" value="yes" />'),
        $display_count = $('<param name="display_count" value="yes" />'),
        $display_spinner = $('<param name="display_spinner" value="' + 'no' + '" />');
    $placeholder.append($noscript).append($tableauViz).append($host_url).append($site_root).append($sheetName).append($tabs).append($toolbar).append($static_image).append($animate_trasnsition).append($display_static_image).append($display_overlay).append($display_count).append($display_spinner).appendTo('body');
    console.log(document.body);
});​

From what I can see in my console.log, there are multiple problems – and I’m still too new to this stuff to know exactly why:

enter image description here

  • The URL Encoding in my <div> looks munged. What did I do wrong?
  • The <a> tag nested inside the noscript block looks bad
  • There is a closing </object> tag when it should close after I list my params
  • Closing /> on each my my params is missing- again URL encoding
    strangeness, I assume but not sure how to handle.

I suspect you pros and kick me in the right direction in a couple of seconds….please kick me as you see fit? Thanks.

  • 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-04T12:35:00+00:00Added an answer on June 4, 2026 at 12:35 pm

    I think the best solution would be to create a template in your html and read that instead of making it in javascript..

    Something like

    <!-- template code follows -->
    <script type="text/template" id="tableau">
    <div class="tableauPlaceholder" id="tableauPlaceholder" ..
    ..snip..
            <param name="display_spinner" value="{placeholder}" id="display_spinner" />
    ..snip..
    </div>
    </script>
    <!-- end of template -->
    

    then you need this code to load the template and change the placeholder

    var template = $('#tableau').html(),
        filledTemplate = template.replace('{placeholder}','value for spinner');
    
    $('body').append( filledTemplate );
    

    Demo at http://jsfiddle.net/gaby/9vBGq/1/

    (I have removed the noscript element from the template since everything is done through script)

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

Sidebar

Related Questions

I need to append the following code via innerHTML to a HTML textfield. <script
I used the following jquery to insert a metatag into a html document. <script
HTML is <a>ref</a> I need to get <a>ref</a>text How can i do this? $('a').append('text')
I have following html form: <form method=post action=> <input type=hidden name=userid id=user value=<?php echo
I need to dynamically load content from HTML emails into some type of content
I need to append some text to an input field...
I need to append text repeatedly to an existing file in Java. How do
Need to insert selected text on the page into textarea. There must be some
I have the following html: <!DOCTYPE html> <html> <head> <script src=http://code.jquery.com/jquery-latest.js></script> </head> <body> <span>not
Right now, I have the following: function jQueryToString( jQueryObject ) { return $('<div>').append(jQueryObject.clone()).remove().html(); }

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.