Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/232.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
jQuery/JavaScript-隐藏所有带有ID的元素,并保留所有其他元素_Javascript_Php_Jquery_Mysql - Fatal编程技术网

jQuery/JavaScript-隐藏所有带有ID的元素,并保留所有其他元素

jQuery/JavaScript-隐藏所有带有ID的元素,并保留所有其他元素,javascript,php,jquery,mysql,Javascript,Php,Jquery,Mysql,我正在为产品开发一个目录页。每个产品都有一个带有id的特定div元素。例如: <div id="2354234" class="product">Here is name, image and description of the product</div> <div id="2354235" class="product">Here is name, image and description of the product</div> <d

我正在为产品开发一个目录页。每个产品都有一个带有id的特定
div
元素。例如:

<div id="2354234" class="product">Here is name, image and description of the product</div>
<div id="2354235" class="product">Here is name, image and description of the product</div>
<div id="2354236" class="product">Here is name, image and description of the product</div>
<div id="2354237" class="product">Here is name, image and description of the product</div>
<div id="2354238" class="product">Here is name, image and description of the product</div>
<div id="2354239" class="product">Here is name, image and description of the product</div>
<div id="2354240" class="product">Here is name, image and description of the product</div>
<div id="2354241" class="product">Here is name, image and description of the product</div>
<div id="2354242" class="product">Here is name, image and description of the product</div>
<div id="2354243" class="product">Here is name, image and description of the product</div>
这里是产品的名称、图像和描述
以下是产品的名称、图像和说明
以下是产品的名称、图像和说明
以下是产品的名称、图像和说明
以下是产品的名称、图像和说明
以下是产品的名称、图像和说明
以下是产品的名称、图像和说明
以下是产品的名称、图像和说明
以下是产品的名称、图像和说明
以下是产品的名称、图像和说明
这些产品都是用PHP从MySQL数据库中加载的。在这一页的末尾我有页码。每页仅显示10种产品。所有产品都有300个,所以我有30页,每页10个产品

当用户实时单击某个按钮时,如何进行页面更新,而不重新加载以隐藏除6之外的所有其他元素(例如使用特定ID)

你能给我一些建议吗?我可以很好地使用jQuery和PHP,所以我需要一个如何完成这件事的建议

提前谢谢

使用应该做到这一点:

$('div[id]').not('#2354234,#2354235,#2354236').hide();

你试过ajax吗?我绝对推荐用ajax和PHP控制分页,而不仅仅是在JavaScript中切换项目。这将节省资源,而且您不必担心限制到300种产品。只要在谷歌上搜索“PHPAJAX分页”,你就会得到很多教程。下面是一个例子: