Javascript 使用Wordpress选项页的第一行colspan制作一行
在我的WordPress选项页面中,用于创建我正在使用的字段。它类似于。因此,它们都使用Javascript 使用Wordpress选项页的第一行colspan制作一行,javascript,jquery,wordpress,html-table,meta-boxes,Javascript,Jquery,Wordpress,Html Table,Meta Boxes,在我的WordPress选项页面中,用于创建我正在使用的字段。它类似于。因此,它们都使用do\u settings\u fields函数,该函数生成如下代码: <table class="form-table"> <tr> <th scope="row">Header 1</th> <td>Element 1</td> </tr> <tr> <th scope="row"
do\u settings\u fields
函数,该函数生成如下代码:
<table class="form-table">
<tr>
<th scope="row">Header 1</th>
<td>Element 1</td>
</tr>
<tr>
<th scope="row">Header 2</th>
<td>Element 2</td>
</tr>
<tr>
<th scope="row">Header 3</th>
<td>Element 3</td>
</tr>
<tr>
<th scope="row">Header 4</th>
<td>Element 4</td>
</tr>
</table>
jQuery(document).ready(function()
{
jQuery('th[scope="row"]').first().hide();
});
但这并不能完全解决我的问题。因为我不介意我只使用一行,但是对于多行来说这是非常有问题的。也许我需要关闭
表
标记并再次打开一个新的表
标记,但我用有限的jQuery知识无法做到这一点。合并两列时,必须使用“colspan”属性,这可能会有所帮助,在这里我将分享jQuery的代码
$(document).ready(function(){
var $table_head = jQuery('tr').first();
var value = $table_head.text();
$table_head.html('<th colspan="2">'+value+'</th>');
});
$(文档).ready(函数(){
var$table_head=jQuery('tr').first();
var值=$table_head.text();
$table_head.html(“”+value+“”);
});