jQuery - Add event handler for on click to redirect and highlight the row clicked

Hi All,

I have a report that has rows showing a billing customer. It has cust_id hidden input field in each row.

Was thinking adding a event on click handler to all those <TR> that contain an input type="hidden" id="cust_id" value="1234"
so the on-click would be on the cell or row. When click the cell or row, hi-light the background of the cells to be blue and then be redirected to another page by grabbing the cust_id value.

This report is created in an APEX region which makes me

thank you for your help,
Bill
LVL 2
BILL CarlisleAPEX DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

BILL CarlisleAPEX DeveloperAuthor Commented:
example

<tr><td headers="sub">John</td><td headers="Cust_Name"><input type="hidden" name="f23" value="AS11147">British Solutions, 235 Kathryn Ste C 129</td></tr>
0
Chris StanyonWebDevCommented:
Here's a general overview, but you'll need to tweak it to you needs. It assumes your table has an ID of myTable, and that your hidden input is called f23. It also adds a class to the clicked TR called blue, that looks like this:

.blue { background-color: blue; }


$('#myTable tr').click(function() {
    $('#myTable .blue').removeClass('blue');
    $(this).addClass('blue');
    var hiddenVal = $('input[name=f23]', this).val();
    window.location = "http://yourDomain.com?testVal=" + hiddenVal;
});

Open in new window


You can see it working here: http://jsfiddle.net/ChrisStanyon/x7yc8433/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
BILL CarlisleAPEX DeveloperAuthor Commented:
Wow! Thanks, that looks like it will do it!
Will add it now..
0
BILL CarlisleAPEX DeveloperAuthor Commented:
That did it! Thanks so much Chris !!!!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
jQuery

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.