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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T06:45:56+00:00 2026-06-02T06:45:56+00:00

Is it possible to obtain the raw HTML of an element or is it

  • 0

Is it possible to obtain the raw HTML of an element or is it possible to get the HTML without the “style” attribute ? Consider the following example,

<div class="outer">
   <div class="inner">
       some text
   </div>
</div>

Now, I apply some animation/CSS to the “inner” element.

​$('.inner').animate({
    'margin': '-10px'
});​​

When I get the HTML of the “outer” element using console.log($('.outer').html());, I get the following

<div class="inner" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">
       some text
   </div>

But, I actually need this only

<div class="inner">
       some text
   </div>

What is the simplest way to get that output ?? I don’t need to create a backup of the element before applying the animate() or css().

Thank you.

  • 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-02T06:45:57+00:00Added an answer on June 2, 2026 at 6:45 am

    If you want to remove the style attribute totally (and don’t want it back), use the code below:

    /* Working code */ 
    $(".outer").find(".inner").removeAttr('style').end().html();
    
    /* Explanation of working code */
    $(".outer")                     // Get the outer element
               .find(".inner")      // Find the inner div
               .removeAttr('style') // Remove the attribute from the inner div
               .end()               // Return to the outer div
               .html();             // Get outer div's HTML
    

    Here’s a working fiddle.

    jQuery Docs:

    • find()
    • removeAttr()
    • end()
    • html()
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it possible to obtain the id of an element (div, input etc) using
Is it possible to obtain an instance of Class<SomeGenericClass<SomeType>> ? For example an instance
Is it possible to obtain the function behind a C# operator? For example in
Is it possible to obtain more than 16 digits with double precision without using
Is it possible to obtain styled attributes values from particular Theme without setting the
Is it possible to obtain a reference/pointer to a class type and enforce that
Is it possible to obtain references to an object's methods? For example, I'd like
Is it possible to obtain the datatype of a column without clicking through the
is it possible to obtain the instance name of a class from the class
Is it possible to obtain a Class reference to a Vector.<T> ? I tried

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.