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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:54:46+00:00 2026-05-26T21:54:46+00:00

The page has the following CSS: input[type=text] { display: inline; padding: 7px; background-color: #f6f6f6;

  • 0

The page has the following CSS:

input[type=text]
{
    display: inline; padding: 7px; background-color: #f6f6f6; font-size: 12px; letter-spacing: 1px; border: 1px solid #aac7d1; 
    /* lots of other styles here... */
}

I have many text-input elements and the following:

<input type="text" id="txt1" />

And I try to apply different styles to this individual textbox (txt1) via jQuery:

$('#txt1').removeClass().removeAttr('style').css({
    'background-color': '#ff0000',
    //lots of other styles here...
});

But those styles that come from the style-sheet cannot be removed from the element this way. The css rule, input[type=text] is not a custom class so removeClass() does not work here, if I’m right.

What I want to do is; to completely remove all styles ever applied to the element txt1. Is there a certain way to do this other than getting the list of all computed styles and setting them empty?

  • 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-26T21:54:47+00:00Added an answer on May 26, 2026 at 9:54 pm

    Is there a certain way to do this

    There is no way to stop rules applying to an element if the selector matches.

    You can either

    • set every property you want to have a specific value (with a suitably specific selector and !important
    • move the element to a different document (which could then be loaded with, for example, an iframe).
    • remove the rule (and thus cause it to not apply to any element)
    • change the selector on the ruleset (so it doesn’t match the element any more, you have to be careful to make sure it still selects elements you care about)

    other than getting the list of all computed styles and setting them empty?

    That wouldn’t work. Most properties won’t accept a blank value, so the rule would be invalid and ignored (thus causing the previous rule to apply again).

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

Sidebar

Related Questions

I have following textbox in my first HTML page: <input tabindex=4 type=text class=search_textbox roundedCorners
I'm reloading a web page that has the following code: <label for=showimage>Show Image</label> <input
The following page has white (left) and dark gray (right) background. I checked the
I currently have the following CSS: a.enabled:hover { background-color: #f9f9f9; border: 1px solid #ddd;
In one page, it should show records that has the following selected month from
I have a page that I'm working on that has the following HTML markup:
I wrote the following script for a page which has been loaded with a
I've got a navigational bar ( #nav_bar ), which has the following CSS properties:
On this page the Longitude form input has a width of 181px and the
I have a master page, and this master page has the following code <%@

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.