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

  • Home
  • SEARCH
  • 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 6576261
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:29:26+00:00 2026-05-25T15:29:26+00:00

Sometimes, it is useful to create DOM elements as jQuery objects for use as

  • 0

Sometimes, it is useful to create DOM elements as jQuery objects for use as selectors and context.

The following works in both IE7,IE8 and all other browsers using jQuery 1.6.2/3 – but note that document.createElement is used to make this work.in IE7 and IE8.

   jQuery('body').append('<div id="basic-render-test"> </div>');

   var new_object = {};
   new_object.wrapper = '<span id="adfasdfasdfwersadfas3rs">';
   //alert(typeof new_object.wrapper);

   if (jQuery.browser.msie && jQuery.browser.version <= 8.0){ 
       new_object.el = document.createElement(new_object.wrapper);
   } else  {
       new_object.el = jQuery(new_object.wrapper);
   }

   new_object.render_into = "#basic-render-test";
   jQuery(new_object.render_into).append( new_object.el );
   some_html = '<DIV id="type-m" class="translate"> HELLO IE</DIV>';
   jQuery(new_object.el).html( some_html );

The declared DOM type is HTML 5

<!DOCTYPE HTML>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> 
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  • 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-25T15:29:26+00:00Added an answer on May 25, 2026 at 3:29 pm

    You need to provide an actual valid html code for it to be created properly. In your exemple, your span tag is not closed, which result in an invalid code at evaluation in IE while other browsers tend to fix it automagically.

    Replace

    new_object.wrapper = '<span id="adfasdfasdfwersadfas3rs">';
    

    With

    new_object.wrapper = '<span id="adfasdfasdfwersadfas3rs"></span>';
    

    This exemple runs perfectly on both IE 7 and 8

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

Sidebar

Related Questions

Sometimes it is useful to use the starting address of an std::vector and temporarily
As a software engineer, I sometimes use Poser Pro to create artwork to insert
Sometimes it might be useful, but mostly just looking cool or impressive to visualize
Sometimes, it is useful to hide a string from a binary (executable) file. For
Memcached interface is implemented using a textual protocol. Sometimes it's very useful to be
Sometimes, when using macros to generate code, it is necessary to create identifiers that
Sometimes it would be useful to name variables like no programmer should name his
Recently I create a mapping to toggle highlight search. That's simple but quite useful,
I'm building a shared library in C, which other programs use. Sometimes, these other
In multi-user environment it's sometimes very useful to know the real author of each

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.