how to switch between two class attribute of tr using javascript without page refresh

Posted on 2009-12-20
Last Modified: 2012-05-08
On a javascript on click validation, i have to toggle a field(remove or add) in JSP, where as if i remove a field, then i have to assign a value for the class attribute <tr class="roll1"> or if i add i have assign another value. <tr class="roll2">. i have to do this without refresh.
Question by:rakztech
    LVL 3

    Expert Comment

    when looping through the tables rows just set the items cssName.

    check here for more info

    let me know if that doesnt help and u need the code done for you

    LVL 75

    Expert Comment

    by:Michel Plungjan
    if the validation is serverside you will need to look into ajax
    LVL 40

    Accepted Solution

    you can change the classname of an element (td, tr etc) using javascript like this
    document.getElementById('tr1').className = 'roll2';


    Author Closing Comment

    solution was helpful

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
    This article will show, step by step, how to integrate R code into a R Sweave document
    Learn the basics of if, else, and elif statements in Python 2.7. Use "if" statements to test a specified condition.: The structure of an if statement is as follows: (CODE) Use "else" statements to allow the execution of an alternative, if the …
    The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

    761 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    7 Experts available now in Live!

    Get 1:1 Help Now