Well, i have a table that is generated dynamically and i don't have access to the source code. Each <tr>
has a single <td>
and inside a <td>
i have:
<td><label>sdsd</label><input text /><label>uuyti</label><select><开发者_如何学Go;/select></td>
it happens that i am using css, and i want the fields on the two rows to be perfectly aligned, but on the second row, i have a nbsp between the second label and the select, so i want to remove that nbsp but i don't know how to reach it with jquery.
Thank you
If you want to remove all
you can use the following:
$("tr td").html(function(i, h) {
return h.replace(/ /gi, "");
});
Example on jsfiddle.
If you want to place a
after the second label you can use eq()
and after()
$("tr td label:eq(1)").after(" ");
Example on jsfiddle.
$("tr td").each(function(index, html){
$(this).replaceWith($(this).html()+" ");
});
this appears to be working on jsfiddle. still testing
精彩评论