zoukankan      html  css  js  c++  java
  • jsp 页面通过jq处理默认 选中的项 数据是通过遍历显示

     jsp页面循环显示里面是<a></a>或者<input>  id 以什么开头的id,然后当你点击那个的时候就在那个上面添加样式

    <div>

    <div class="serviceLeft floatL">

             <!-- 选中颜色样式 mianColor -->

             <!-- <div id="" class="text-align-center"><a href="#" class="mianColor">知识产权</a></div> -->

    <c:forEach items="${slist }" var="s">

             <div class="text-align-center">

    <a href="#"id="choice_${s.id }">${s.supportingname } </a>

    </div>

    </c:forEach>对应的标签类型

    </div>

    <script type="text/javascript">

             $(document).ready(function(){

                       $("a[id^='choice_']").each(function () {

                       $("a[id^='choice_']:first").attr("class","mianColor");   ----à默认选中第一个

                       $(this).bind(“click”, function () {

                                $(“a[id^=’choice_’]”).each(function () {

                                         $(this).removeAttr(“class”);-------------à去掉样式

                                         });

                                $(this).attr("class","mianColor");----------------à添加样式

                                });

                       });              

             });

    </script>

  • 相关阅读:
    Kernel parameter requirements ( Linux DB2)
    db2 backup export
    db2 活动日志激增的原因分析处理
    db2 应用的最常见状态(转)
    db2 reorg到底需要多少表空间(转)
    HDLM for AIX安装
    db lock
    db2 tablespaces table bufferpools reorgs
    AIX文件系统和存储部署(转)
    真正看网络代码
  • 原文地址:https://www.cnblogs.com/lemon863376328/p/4969096.html
Copyright © 2011-2022 走看看