I have generated a table with JQuery csv2table plugin. How could I insert checkboxes in every table box?
I don't know the plugin, but in general .append()
help and .appendTo()
help should help you out here.
$('<input>', {
type: 'checkbox'
}).appendTo(/* "#tableid" or "#tableid td" or "#tableid .tablebox" */ );
Update
In referrence to your comment. You can use jQuerys :nth-child
help selector to have a query like I believe you want. For instance
.appendTo($('#table').find('tr:nth-child(3n)').find('td:nth-child(8n)'));
Or you can also use the insertBefore
method:
Example:
$('<input type="checkbox" name="namehere" />').insertBefore('selector');
$(function(){
var counter=1;
var chk="<input type='checkbox' id='chk_'"+counter+"'/>";
$("table#t tr td").each(function(){
$(this).append(chk);
counter++;
});
});
try here
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.