0

I want to select multiple rows in a table without using a checkbox. Is there any way to do this?

0

2 Answers 2

0

If it's just visually select you're after, it's very possible with Javascript and CSS.

Using jQuery, or some other JS library, you can add a HTML class to the row on click. Then use CSS to style that class.

jQuery:

$('tr').click(function(){ $(this).toggleClass('selected'); });

CSS:

tr.selected { background: #ccc; }
Sign up to request clarification or add additional context in comments.

4 Comments

Of course, there's no reason why you couldn't back this with a hidden field that effectively emulated a checkbox from the form processor's perspective. That said, graceful degradation would be an issue. :-)
@middapark: "why you couldn't"* presumably :)
@Tomalak Geret'kal Yup. Fixified. Ta for the heads up. :-)
Yes, but I wouldn't bother hiding the checkbox. This solution should really be an extension of the checkbox, for 508 compliance at least.
0

I am not sure if this is related, but take a look at this SO question.

It's using jQuery UI Selectable to perform a drag selection. You can the demo here and here for grid like setting.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.