jquery - How can I pass a row as parameter to javascript? -
I want to get one line information to show in the tooltip. For example:
& lt; Html & gt; & Lt; Table style = "width: 100%" & gt; & Lt; TR & gt; & Lt; TD & gt; Jill & lt; / TD & gt; & Lt; Td onmouseover = "loadtooltip (parameter)" & gt; Smith & lt; / Td> & Lt; TD & gt; 50 & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Eve & lt; / TD & gt; & Lt; Td onmouseover = "loaderolite (parameter)" & gt; Jackson & lt; / Td> & Lt; TD & gt; 94 & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; Html & gt;
Therefore, when I put the mouse on the line, then I need the contents of the other columns.
Thx in advance
You have tagged your question with jQuery, so I'm assuming that a jQuery solution is acceptable is. First of all, do not inline your event operators, this is a bad form, instead, hook your event handlers using .on
instead. I've added a class to identify td
, you want to add the roll to a little easier. So in the handler, this
will refer to an event that receives this event and you can use $ (this). Parent ()
this is the parent tr
.
& Lt; script src = "https: //ajax.googleapis. Com / ajax / libs / jquery / 2.1.1 / jquery.min.js "& gt; & lt; / script> gt; & lt; html & gt; table style =" width: 100% "& gt; ; & Lt; tr & gt; & gt; TD & gt; Jill & lt; / td & gt; & lt; td class = "rollable" & gt; Smith & lt; / td & gt; & lt; TD> 50 gt; & lt; td> 94 & lt; / td & gt; & lt; / tr & gt; & lt; / table & gt; Lt; html & gt;
Edit: Your comment shows that you actually
& lt; Script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Html & gt; & Lt; Table style = "width: 100%" & gt; & Lt; TR & gt; & Lt; TD & gt; Jill & lt; / TD & gt; & Lt; Td square = "rollable" & gt; Smith & lt; / Td> & Lt; TD & gt; 50 & lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; Eve & lt; / TD & gt; & Lt; Td square = "rollable" & gt; Jackson & lt; / Td> & Lt; TD & gt; 94 & lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; Html & gt;
Comments
Post a Comment