Hi
I am displaying data in a table. I have text box . I want whatever is entered in a Textbox it should find that value in Book column of that table. If found in any row then Book Column should be highlighted
Thanks
Hi
I am displaying data in a table. I have text box . I want whatever is entered in a Textbox it should find that value in Book column of that table. If found in any row then Book Column should be highlighted
Thanks
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Ramco RamcoPosted Jun 7, 2023, 5:46 AM
Hi AMit
I want to pass the value in Textbox from here . Then it should search a table
Thanks
Amit MohantyPosted Jun 7, 2023, 5:31 AM
Deepak RawatPosted Jun 7, 2023, 5:07 AM
To achieve the desired functionality, you can use JavaScript/jQuery to handle the user input, search for the value in the table, and highlight the corresponding cells. Here's an example implementation:
HTML
JavaScript/jQuery:
CSS
In the above code, we bind an event handler to the input element with the ID "searchBox" using the
on('input')function. Whenever the user enters or modifies the text, the handler is triggered. It retrieves the entered value, converts it to lowercase, and iterates over each row in the table body. For each row, it retrieves the book name from the first column, converts it to lowercase, and checks if it includes the search term. If it does, the 'highlight' class is added to the row, which applies the desired CSS styling. Otherwise, the 'highlight' class is removed.Note that the code uses jQuery, so make sure you have included the jQuery library in your HTML file. You can include it by adding the following line before the JavaScript code:
You can modify the code to suit your specific table structure and styling requirements.