The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> HIGHLIGHT NEXT HIGHER VALUE IN A TABLE CELL TO THE GIVEN VALUE
shankar from vizag
post Aug 24 2022, 11:06 AM
Post #1


Advanced Member
****

Group: Members
Posts: 202
Joined: 18-June 13
Member No.: 19,316



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.Attached File  test.html ( 2.09k ) Number of downloads: 280


Regards
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 24 2022, 02:12 PM
Post #2


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



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).








User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
shankar from vizag
post Aug 24 2022, 07:42 PM
Post #3


Advanced Member
****

Group: Members
Posts: 202
Joined: 18-June 13
Member No.: 19,316



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Aug 25 2022, 11:08 AM
Post #4


.
********

Group: WDG Moderators
Posts: 9,630
Joined: 10-August 06
Member No.: 7



How is the table generated? If it comes from a database, maybe you could sort the table data already in the DB query.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
2 User(s) are reading this topic (2 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 28th March 2024 - 04:54 PM