- when first "read more" href click, div changed.first click it span and when second click it shrink.
- But it is not work for other href element
-
how to solve this problem.please help me.
<script> $(document).ready(function(){ $('#more').click(function(){ var toggleheight = $("#readmore").height() == 500 ? "100px" : "500px"; $('#readmore').animate({ height: toggleheight }); }); }); </script>
-
here is the php code
<?php mysql_query("SET NAMES 'utf8'"); $set_news=mysql_query("SELECT solution_date,Category,solution FROM solution ORDER BY solution_date DESC LIMIT 10",$connection); if(!$set_news){ die("database query failed".mysql_error()); } for($i=1;$i<=10;$i++) { $rowofnews=mysql_fetch_array($set_news); $category=$rowofnews['Category']; $solution=$rowofnews['solution']; echo ('<li>'); echo ('<div id="readmore"'); echo('<h2>'); echo $category; echo('</h2><p>'); echo $solution; echo('</p></div>'); echo('<p><span><a href="#" class="more" id="more">Read More</a></span></p></li>'); } ?>
jquery不适用于每个href元素
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
2条回答 默认 最新
- duangang1991 2013-12-14 10:45关注
If you're trying to select multiple elements, you shouldn't use ID's, you should select by
class
, like this:$('.more').on("click", function(){
解决 无用评论 打赏 举报
悬赏问题
- ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
- ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
- ¥15 CSAPPattacklab
- ¥15 一直显示正在等待HID—ISP
- ¥15 Python turtle 画图
- ¥15 关于大棚监测的pcb板设计
- ¥15 stm32开发clion时遇到的编译问题
- ¥15 lna设计 源简并电感型共源放大器
- ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
- ¥15 Vue3地图和异步函数使用