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>

jsp 页面通过jq处理默认 选中的项 数据是通过遍历显示的更多相关文章

  1. 【WPF】ListBox使用DataTemplate 以及默认选中第一项Item

    ListBox中DataTemplate的用法如下 . <ListBox x:Name="areaLB" ItemsSource="{Binding AreaNum ...

  2. Easyui combobox如何默认选中第一项???

    以下代码可以实现combobox默认选中第一项,在实际开发中我们可能会用到! // 处理combobox默认选中的问题 <input id="user_type" class ...

  3. JSP页面获取下来框select选中项的值和文本的方法

    <select id="username"  name=""> <option   value="1">jyy< ...

  4. ionic中ng-options与默认选中第一项的问题

    1. select中动态添加数据时发现一个选项为空,在选中了其他选项时,在点击时发现第一个空选项消失了,所有我们需要设置一个默认的选项: 2. 开始的时候我用的方法: <select class ...

  5. elementUI的导航栏怎么根据路由默认选中相关项

    1. <el-menu :default-active="this.$route.path.substr(1)" class="left-nav"> ...

  6. ztree树默认根据ID默认选中该条数据

    functiongetZtree() { varsetting = { view: { expandSpeed: 100, selectedMulti: true, showLine: true, / ...

  7. Easyui combobox下拉框默认选中第一项

    var val = $(#cc).combobox("getData");for (var item in val[0]) {       if (item == "gr ...

  8. jquery easyui combobox设置默认选中第一项

    combobox的内容是从后台获取的json, js截取: var data = $('#id').combobox('getData'); $("#id ").combobox( ...

  9. 在table中选中某条数据,让其显示对应详细信息

    在第一个页面中使用 ccms.dialog.open({url:url+$(this).attr("code"),id:"dialogPic",width:10 ...

随机推荐

  1. Java Networking: InetAddress

    The InetAddress is Java's representation of an IP address. Instances of this class are used together ...

  2. Why should i use url.openStream instead of of url.getContent?

    I would like to retrieve the content of a url. Similar to pythons: html_content = urllib.urlopen(&qu ...

  3. nyoj 55 懒省事的小明【优先队列】

    懒省事的小明 时间限制:3000 ms  |  内存限制:65535 KB 难度:3   描述       小明很想吃果子,正好果园果子熟了.在果园里,小明已经将所有的果子打了下来,而且按果子的不同种 ...

  4. POJ 3125 Printer Queue

    题目: Description The only printer in the computer science students' union is experiencing an extremel ...

  5. FZU2138-久违的月赛之一

    Problem Description 好久没举月赛了,这次lqw给大家出了5道题,因为hsy学长宣传的很到位,吸引了n个DDMM们来做,另一位kk学长说,全做对的要给金奖,做对4题要给银奖,做对3题 ...

  6. JDBC——事物管理

    案例:银行转账问题,数据库如下 相关API setAutoCommit(boolean autoCommit)  将此连接的自动提交模式设置为给定状态.设置事务是否自动提交如果设置为false,表示手 ...

  7. android关机充电

    1.关机充电其实是进入adb shell很快的方式! 2.手机关机时候插入USB,手机将进入关机充电模式,那么这个模式究竟是怎么进行的,这里分析如下! (1)uboot:这里代码大概浏览了一下:u-b ...

  8. Hadoop-2.4.1学习之Map任务源代码分析(下)

    在Map任务源码分析(上)中,对MAP阶段的代码进行了学习,这篇文章文章将学习Map任务的SORT阶段.假设Reducer的数量不为0.则还须要进行SORT阶段.但从上面的学习中并未发现与MAP阶段运 ...

  9. JAVA IO之管道流总结大全(转)

    要在文本框中显示控制台输出,我们必须用某种方法“截取”控制台流.换句话说,我们要有一种高效地读取写入到System.out和 System.err 所有内容的方法.如果你熟悉Java的管道流Piped ...

  10. Linux下设置最大文件打开数nofile及nr_open、file-max

    在开发运维的时候我们常常会遇到类似“Socket/File: Can’t open so many files”,“无法打开更多进程”,或是coredump过大等问题,这些都可以设置资源限制来解决.今 ...