我在一个页面上有多个表格,并且有一个从array_keys
开始的数字数组。隐藏<tr>包含特定ID的
我已经给每个<tr>
一个增量ID,从0开始。如果我的数组返回0,1,3,5我想<tr>
的ID为2和4来隐藏。通常我会使用CSS并应用样式:display = none。
我相信我需要一个阵列内循环使用jQuery .find()像这样:
$arr = array_keys($floor_item, $po); //floor_item is my array & po is the value I'm searching
foreach($arr as $key => $item){
print "<tr id='" . $item . "'><td>" . $item . "</td></tr>"; //this will show me the id's I want
//just guessing here
$("tr").find("$item").hide();
}
只有数字ID是一个HTML 5功能...最好你前缀他们和前缀匹配使用'$('tr [id^= myprefix]') – 2014-10-08 15:15:50
你不能在php代码中使用jQuery。 – vaso123 2014-10-08 15:30:06