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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:05:10+00:00 2026-06-01T23:05:10+00:00

I have a few predefined styles in my css based on an elements attribute.

  • 0

I have a few predefined styles in my css based on an elements attribute. If i update the attribute’s value to something new that also has a predefined style the style is applied in FF and Chrome but not IE. See example and type in input field please.

JS:

$('input').on('keypress', function(){
    var l = parseInt($(this).attr('level'), 10) + 1;
    $(this).attr('level', l);
});

CSS:

input[level="0"]{background:red;}
input[level="1"]{background:blue;}
input[level="2"]{background:green;}
input[level="3"]{background:black;}

http://jsfiddle.net/ce6S4/

Any help is appreciated, thank you.

EDIT:
works with IE 9 but not <= 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-06-01T23:05:13+00:00Added an answer on June 1, 2026 at 11:05 pm

    It’s an IE-bug. Notice that the element is rendered correctly when you resize the window.

    Trigger the reflow by setting the class name:

    this.className = this.className; // Or .addClass(' ');
    

    Demo: http://jsfiddle.net/ce6S4/6/

    $('input').on('keypress', function(){
        var l = parseInt($(this).attr('level'), 10) + 1;
        $(this).attr('level', l).addClass(' ');
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a form with few predefined textboxes, now in addition to that I
I have few questions, I want to show the alert window on my Update
I have a webpage that is a Search page. There are a few pre-defined
Have few columns and tables, as follows: NOTE : The names of elements used
i have few texboxt and dropdownlist, which their id would be something like txtName1,
edit: I have added a few new lines of code to the beginning for
By default, any named function that has the [CmdletBinding()] attribute accepts the -debug and
I have few pages that I show from my main page inside iframe .
I am creating a few snippets and have found that there are a couple
I have a few static household ads in an UIImageView that just display some

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.