javascript - Table using a tag and spans -
i building table using css , combination of <a>
tags <span>
s :
<a class='header'> <span>user id</span> <span>name</span> <span></span> </a> <a href='somesite.php'> <span>7</span> <span>ofek</span> <span><button type="button" onclick="somefunc()">add favourites</button></span> </a>
the results looks :
now problem when click button still redirected somesite.php, , function somefunc() never gets called, seen somewhere button cant nested inside span, whats alternative make work? want whenever user click on line redirected him somesite.php, not when presses button, want func somefunc() called.
nesting button
element in a
element creates problems in handling events, , forbidden in html5 cr.
the simple way avoid creating problem separate interactive elements:
<a href='somesite.php'> <span>7</span> <span>ofek</span> </a> <span><button type="button" onclick="somefunc()">add favourites</button></span>
this not possible (as such) in logical approach use table
markup, it’s simple if simulating table css cells span
elements (or, generally, phrase/inline/text-level elements).
Comments
Post a Comment