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 :

enter image description here

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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -

php - Accessing static methods using newly created $obj or using class Name -