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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:15:58+00:00 2026-05-16T18:15:58+00:00

I want to set an attribute of a DOM element using element[attribute] , but

  • 0

I want to set an attribute of a DOM element using element["attribute"], but the value is URI encoded. For instance, if the value is q=test&r=123&s=456 and after I append it into the DOM, the value becomes q=test&r=123&s=456.

Now, view RENDERED source, or Copy HTML of the script tag using Firebug…

Please copy paste the code below on a new HTML file for your valuable investigation.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
    <a href="javascript: injectTag();">Inject Tag</a>
    <div id="status"></div>
    <script>
        var injectTag = function () {
            var scriptTag = document.createElement("script");
            scriptTag["src"] = "http://www.google.com/search?q=US+Geological+Survey&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-US:official&client=firefox-a";
            scriptTag["type"] = "text/javascript";

            var head = document.getElementsByTagName("head")[0];
            head.appendChild(scriptTag);
            document.getElementById("status").innerHTML = "Now, view <b>RENDERED source</b>, or <b>Copy HTML</b> of the script tag using Firebug...";
        }
    </script>
</body>
</html>

With thanks and Regards,
Munim

  • 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-05-16T18:15:59+00:00Added an answer on May 16, 2026 at 6:15 pm

    What you see is exactly what should happen.

    The value is not URI-encoded, though. It is HTML-escaped.

    All data (data is: attribute values and text) within an HTML page must be HTML-escaped (& becomes &amp; in the source code, < becomes &lt;, and so on). Most browsers are forgiving if you forget to do this, but it is wrong nevertheless.

    If you add data dynamically, the DOM just follows that rule and HTML-escapes the data for you.

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

Sidebar

Related Questions

I want to set id of an element. I'm using php dom. I could
I want to set the attribute ref_id with _0 suffixed, but <xsl:attribute name=ref_id select=$id_0
I want to set attribute of a file in network to ReadOnly. File.SetAttributes(@\\data\ntshare\tmp\Trades_LastFileUploaded.csv, FileAttributes.ReadOnly);
I have a view that has a tooltip attribute. I want to set that
I want set Listbox background to transparent but not working Is there any idea?
i want set class for repeater when doPostBack for those dataID i wan but
I am developing extension for Firefox 3.0-3.5 versions using VS2008. I want to set
I want to set a read-only attribute inside a class method. I have already
I'm using cloneNode(true) to make copies of DOM elements (for instance a div containing
I am working on an MVC2 application and want to set the maxlength attributes

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.