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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T20:40:13+00:00 2026-06-14T20:40:13+00:00

I hope you can help me. I am building a table dynamically using MVC.

  • 0

I hope you can help me. I am building a table dynamically using MVC. Depending on the situation the table will have different number of rows and columns. Each row represents a Quality Parameter that I am trying to measure (eg, Moisture, Protein…etc). The first two columns contain the name of the Quality Parameter and the Input Text Box for capturing the value. After that each additional column contains a product which I am trying to validate against. Within those columns i have placed a that contains attributes minValue and maxValue which are what I am trying to validate against.

The basic logic for each row is this…

if (Text Box Value >= minValue && Text Box Value <= maxValue), set div class “tick” else set div class “cross”.

My CSS then will display either an image of a Tick or a Cross depending on the validation…

My JQuery skills are pretty poor. I know I need to do the following, but i am not sure how….

  1. Put a change event on all my input text fields.
  2. When a value changes, loop through all div in the same tr block and validate the minValue/maxValue against the text box field.
  3. Set the class of the div to either tick/cross depending on the validation.

Here is an example of the HTML…

<table class="dataTable">
    <thead>
        <tr>
            <th>Parameter</th>
            <th>Value</th>
                <th>APH1</th>
                <th>APH2</th>
        </tr>
    </thead>         
    <tr>
        <td>    
            Protien
        </td>
        <td>
            <input class="text-box single-line" id="AnalyseQualityParameters_0__Value" name="AnalyseQualityParameters[0].Value" type="text" value="13.00" />
        </td>
        <td><div class="cross" minvalue="14.00" maxvalue="100.00">&nbsp;</div></td>
        <td><div class="tick" minvalue="13.00" maxvalue="100.00">&nbsp;</div></td>
    </tr>
    <tr>
        <td>    
            Moisture
        </td>
        <td>
            <input class="text-box single-line" id="AnalyseQualityParameters_1__Value" name="AnalyseQualityParameters[1].Value" type="text" value="44.00" />
        </td>
        <td><div class="cross" minvalue="0.00" maxvalue="12.50">&nbsp;</div></td>
        <td><div class="cross" minvalue="0.00" maxvalue="12.50">&nbsp;</div></td>
    </tr>
</table>    

If anyone could help me get started I would really appreciate it.

Thanks in advanced!

  • 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-14T20:40:14+00:00Added an answer on June 14, 2026 at 8:40 pm

    I believe the following does what you need

    $('.text-box.single-line').change(function(){
        /* get value of current input*/
        var val=$(this).val();
        /* loop over the cross elements in same row, "this" is the current input */
         $(this).closest('tr').find('.cross').each(function(){
            /* "this" is the current cross element*/
                var min= 1 * $(this).attr('minvalue');
                var max= 1 * $(this).attr('maxvalue');
    
                var thisClass= ( val >= min && val <= max ) ?'tick' : 'cross';
                /* remove prior class and add new one*/
                $(this).removeClass('tick cross').addClass( thisClass);
    
         })
    })
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hope someone can help. I have two tables: Users -UserID -UserName UsersType -UserTypeID -UserID
I hope you can help me. I have a web service that needs to
I hope you can help. This has been confounding me for hours. I have
Hope someone can help, I'm not a programmer, but have been interested in exploring
Hello all I have a question I hope you guys can help me with.
hope you can help me! I have a form, which has a large amount
I'm having a very specific problem so I hope someone can help. I'm building
Hope someone can help i cant seem to get my head around this, i
Hope someone can help me out with this problem I am having. I just
I hope you can help, I've tried for hours to understand mod rewrite but

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.