how to make a whole row in a table clickable as a link?

前端 未结 26 1680
粉色の甜心
粉色の甜心 2020-11-22 14:05

I\'m using Bootstrap and the following doesn\'t work:


    
        
            Blah Blah
           


        
26条回答
  •  情话喂你
    2020-11-22 14:17

    The accepted answer is great, but I propose a small alternative if you don't want to repeat the url on every tr. So you put the url or href in the table data-url and not the tr.

    Blah Blah 1234567 £158,000
    Blah Blah 1234567 £158,000

    This is also good because you don't need to add the click data attribute to every tr either. The other good thing is that we are not using a class to trigger a click as classes should only really be used for styling.

提交回复
热议问题