The example of this article describes the method of dynamically creating complex tables with jQuery+json. Share it with everyone for your reference, the details are as follows:
function SetSubTable() { var obj = jQuery.parseJSON($("#SubJsonStrValue").val()); window.ALLPARAMTERS = obj; var row_str = ""; var span_num = 1 for (var i = 0; i < obj.length; i++) { if (obj[i].ParamNames.length > 0) { row_str += '<tr><td rowspan="' + obj[i].ParamNames.length + '"><input type="checkbox" name="_'+obj[i].Id+'" />' + obj[i].Name + '</td>'; for (var j = 0; j < obj[i].ParamNames.length; j++) { if (j != 0) { row_str += "<tr>"; } row_str += '<td><input type="checkbox" name="p_'+obj[i].ParamNames[j].Id+'_'+obj[i].Id+'" />' + obj[i].ParamNames[j].Name + '</td><td>'; for (var k = 0; k < obj[i].ParamNames[j].ListItems.length; k++) { row_str += obj[i].ParamNames[j].ListItems[k].Name+"|"; } row_str = row_str.substring(0, row_str.length - 2); row_str += "</td><td>"; if (obj[i].ParamNames[j].CanMultiSelecte) { row_str += "多选"; } else { row_str += "单选"; } row_str += "</td></tr>"; } } } $("#sub_table_header").after(row_str); }
I hope this article will be helpful to everyone in jQuery programming.
For more jQuery+json methods to dynamically create complex tables, please pay attention to the PHP Chinese website for related articles!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 Linux new version
SublimeText3 Linux latest version

Atom editor mac version download
The most popular open source editor

SublimeText3 Mac version
God-level code editing software (SublimeText3)

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft