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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:41:05+00:00 2026-06-15T04:41:05+00:00

Setting up an error condition so that when the condition is true a css

  • 0

Setting up an error condition so that when the condition is true a css class will be added.

For example, when the condition is FALSE <p></p> do nothing, if TRUE add a class. <p class="error"></p>.

Here is the jquery I am using to add the calls but it not working.

http://jsfiddle.net/hookedonweb/7XhGC/1/

  • 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-15T04:41:07+00:00Added an answer on June 15, 2026 at 4:41 am

    this example gets an array of all p tags and for each one with empty innerHTML sets the class (you may want to getAttribute and concatenate the new string to the old first if you don’t want to replace existing classes) also older versions of IE may use className

    var ptags=document.getElementsByTagName("p")
    for(var i=0;i<ptags.length;i++)
        if(ptags[i].innerHTML=="")
            ptags[i].setAttribute("class", "myClass")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is probably a setting error somewhere. I have a django app that works
Lint Error Checking tool that comes with Android Developer Tools has an optional setting
What is the proper way to do error-checking in a class? Raising exceptions? Setting
I am having trouble setting my ContentProperty to Text. The error I am given
So I'm setting up my form validation, inputs, error messages etc... and then realized
When using scipy.optimize 's fmin I'm getting an error I don't understand: ValueError: setting
Below, setting text and setting progress gives me the error.. Multiple markers at this
okay, so here is what im doing: class Connection { public int SERVERID; private
Possible Duplicate: Conditional “Browsable” Attribute I define AppSettings class that have a few properties.
Situation is that level of log4net is configured as 'Error' but there is 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.