Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/80.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Wordpress选项页的第一行colspan制作一行_Javascript_Jquery_Wordpress_Html Table_Meta Boxes - Fatal编程技术网

Javascript 使用Wordpress选项页的第一行colspan制作一行

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"

在我的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">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+“”);
});