Help - Search - Members - Calendar
Full Version: HIGHLIGHT NEXT HIGHER VALUE IN A TABLE CELL TO THE GIVEN VALUE
HTMLHelp Forums > Programming > Client-side Scripting
shankar from vizag
Greetings

I have a table column (Current Level) and a textbox. If any value in the table column is supplied in the textbox, the same will be highlighted with the help of jQuery.

2. Here, I need the help to bold and highlight the next immediate higher value also to the given value.

Kindly guide me how to do the same using jQuery.Click to view attachment

Regards
Christian J
Greetings!

I don't do jQuery, so this is just some general javascript-based ideas:

QUOTE(shankar from vizag @ Aug 24 2022, 06:06 PM) *

I have a table column (Current Level) and a textbox. If any value in the table column is supplied in the textbox, the same will be highlighted with the help of jQuery.

The exact value or a partial value? Looking at the current script, it appears typing "63" will make "63100" become highlighted.

QUOTE
Here, I need the help to bold and highlight the next immediate higher value also to the given value.

Are all the values numbers? In that case you should first convert them to numbers (instead of strings), and then look for an exact match. Form field and innerHTML values are strings by default.

Finding the next immediate higher numerical value seems a bit tricky. One idea might be to first build an array of any cell values larger than the text field's, and then sort that array in order to find the lowest array value (which is the one immediately larger than the text field's).








shankar from vizag
QUOTE(Christian J @ Aug 25 2022, 12:42 AM) *

Greetings!

I don't do jQuery, so this is just some general javascript-based ideas:

QUOTE(shankar from vizag @ Aug 24 2022, 06:06 PM) *

I have a table column (Current Level) and a textbox. If any value in the table column is supplied in the textbox, the same will be highlighted with the help of jQuery.

The exact value or a partial value? Looking at the current script, it appears typing "63" will make "63100" become highlighted.

QUOTE
Here, I need the help to bold and highlight the next immediate higher value also to the given value.

Are all the values numbers? In that case you should first convert them to numbers (instead of strings), and then look for an exact match. Form field and innerHTML values are strings by default.

Finding the next immediate higher numerical value seems a bit tricky. One idea might be to first build an array of any cell values larger than the text field's, and then sort that array in order to find the lowest array value (which is the one immediately larger than the text field's).



Thank you christian J. for your guidance. Let me try.
Christian J
How is the table generated? If it comes from a database, maybe you could sort the table data already in the DB query.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2024 Invision Power Services, Inc.