<td> pourquoi html() et non val() ?
Bonjour
petite question qui m'échappe...
Imaginons un tableau tout simple du type :
Code:
1 2 3 4 5
| <table>
<tr id="1216" class="user_row"><td>y</td><td class="uname">truc SANDRINE</td><td>mail@user.com</td><td>login1</td><td></td></tr>
<tr id="937" class="user_row ui-state-disabled"><td>n</td><td class="uname">bidule PATRICE</td><td>mail@user.com</td><td>login1</td><td>31/3/2012</td></tr>
<tr id="1164" class="user_row ui-state-disabled"><td>n</td><td class="uname">machin GARRY</td><td>mail@user.com</td><td>login1</td><td>31/12/2012</td></tr>
</table> |
j'utilise jquery ui et datatables, mais là n'est pas le problème il me semble
je construis l'attribut title de chaque ligne avec ces instructions :
Code:
1 2 3 4
| //marche
$( ".user_row" ).attr("title",function() {
return "Modifier "+$(this).children("td.uname").html().trim();
}); |
si je mets val() à la place de html(), rien !
Code:
1 2 3 4
| //ne marche pas
$( ".user_row" ).attr("title",function() {
return "Modifier "+$(this).children("td.uname").val().trim();
}); |
Pourquoi cela selon vous ? je ne comprends pas pour ma part.
Précision, j'utilise jquery 1.8.2, cela peut il être un bug de version ?