随笔分类 -  jQuery

 
jQ的toggle() 方法
摘要:语法:$(selector).toggle(speed,callback,switch) 实例: <script src="js/jquery.min.js"></script> <script type="text/javascript"> $(function () { $("input").c 阅读全文
posted @ 2018-05-10 09:38 幽默是一种心情 阅读(1163) 评论(0) 推荐(0)
jQuery 获取设置图片 src 的路径
摘要:1.获取: $('#img')[0].src 2.设置:$('#img').attr("src", data.CodeUrl); 阅读全文
posted @ 2018-04-26 15:00 幽默是一种心情 阅读(7692) 评论(0) 推荐(0)
JQ判断div是否隐藏
摘要:1. $("#tanchuBg").css("display") 2. $("#tanchuBg").is(":visible") 3. $("#tanchuBg").is(":hidden") 例: if($("#tanchuBg").is(":hidden")) { alert("隐藏了") } 阅读全文
posted @ 2018-04-26 14:24 幽默是一种心情 阅读(987) 评论(0) 推荐(0)
解决jQuery的toggle()的自动触发问题
摘要:在1.9以后的版本toggle()就存在这个问题,用之前的版本就正常了 解决办法: 1.去 jquery官网下载一个版本升级文件。http://blog.jquery.com/2013/05/08/jquery-migrate-1-2-1-released/ 2.把原来的那块代码拿出来,写成一个插件 阅读全文
posted @ 2018-03-28 13:36 幽默是一种心情 阅读(1233) 评论(0) 推荐(0)
JQuery关于span标签的取值赋值
摘要:span取值赋值方法有别于一般的页面元素。JQ://赋值$("#spanid").html("hello world")//取值$("#spanid").text("hello world") JS: document.getElementById("spanid").innerText = "he 阅读全文
posted @ 2018-03-28 11:05 幽默是一种心情 阅读(2774) 评论(0) 推荐(0)
jQ判断checked是否选中
摘要:(1)、JQ1.6版本之前(不包括1.6版本)判断checkbox是否被选中用的是attr()方法,HTML代码与上面相同,只放JQ代码: console.log($("input[type='checkbox']").attr('checked'));//false 不要想着在JQ1.6版本之前使 阅读全文
posted @ 2018-03-10 18:17 幽默是一种心情 阅读(9248) 评论(0) 推荐(0)
jQ全选或取消全选
摘要:function checkAll(chkobj) { if ($(chkobj).children("span").text() == "全选") { $(chkobj).children("span").text("取消"); $("[name=checkbox]").prop("checked 阅读全文
posted @ 2018-03-10 18:14 幽默是一种心情 阅读(394) 评论(0) 推荐(0)
JQ获取上级、同级、下级元素
摘要:jQuery 1.父级: jQuery.parent(expr) 找父亲节点,可以传入expr进行过滤,比如$("span").parent()或者$("span").parent(".class") jQuery.parents(expr),类似于jQuery.parents(expr),但是是查 阅读全文
posted @ 2018-03-10 16:30 幽默是一种心情 阅读(11135) 评论(0) 推荐(0)
获取jQuery DataTables 的checked选中行
摘要:$(function () { var tabel = $('#userlist').DataTable({ destroy: true, //Cannot reinitialise DataTable,解决重新加载表格内容问题 bProcessing: true, //DataTables载入数据 阅读全文
posted @ 2018-01-09 11:31 幽默是一种心情 阅读(5513) 评论(1) 推荐(0)
jQuery DataTables 问题:Cannot reinitialise DataTable
摘要:解决: destroy: true, var tabel = $('#userlist').DataTable({ destroy: true, //加上此属性即可 bProcessing: true, //DataTables载入数据时,是否显示‘进度’提示 bStateSave: false, 阅读全文
posted @ 2018-01-09 11:27 幽默是一种心情 阅读(2219) 评论(0) 推荐(0)
jQuery DataTables 分页
摘要:HTML: <div class="ibox-content"> <div class="thead"> <input placeholder="请输入搜索内容" id="strWhere" type="text" /> </div> <table id="userlist" class="tabl 阅读全文
posted @ 2018-01-08 14:55 幽默是一种心情 阅读(3693) 评论(0) 推荐(0)
实现页面跳转和重定向的几种方法
摘要:1.js实现页面跳转重定向 window.location.replace("http://www.baidu.com"); window.location.href = "http://www.baidu.com"; window.navigate("http://shanghepinpai.co 阅读全文
posted @ 2018-01-08 11:35 幽默是一种心情 阅读(1516) 评论(0) 推荐(0)
jQury+Ajax与C#后台交换数据
摘要:jQury+Ajax调用后台方法 JS: function CarState(carID) { $.ajax({ type: "Post", url: "ShowMap.aspx/GetCarState", //方法传参的写法一定要对,str为形参的名字 data: "{'carid':'" + c 阅读全文
posted @ 2017-12-25 17:13 幽默是一种心情 阅读(868) 评论(0) 推荐(0)
HeightCharts柱状图和饼状图
摘要:HTML: <div id="container1" style="height:350px; " ></div> <div id="container2" ></div> JS:(引入的有关highcharts的js可在highcharts的官网中获得:https://www.hcharts.cn 阅读全文
posted @ 2017-12-25 17:01 幽默是一种心情 阅读(1000) 评论(0) 推荐(0)
JQ获取当前根目录
摘要:function getRootPath_web() { //获取当前网址,如: http://localhost:8083/uimcardprj/share/meun.jsp var curWwwPath = window.document.location.href; //获取主机地址之后的目录 阅读全文
posted @ 2017-12-25 14:19 幽默是一种心情 阅读(1723) 评论(0) 推荐(0)
jQuery防止中文乱码
摘要:window.location.href = "?supplier=" + escape($("#ddlUser").val()) + "&time=" + $("#txtTime").val(); 阅读全文
posted @ 2017-12-25 13:36 幽默是一种心情 阅读(358) 评论(0) 推荐(0)
jQuery 动态添加、删除css样式
摘要:1.addClass css中: <style type="text/css"> .chColor {background: #267cb7;color:white; } </style> js中: $("#nm_p").addClass("chColor"); // 追加样式 $("#nm_p") 阅读全文
posted @ 2017-12-24 14:38 幽默是一种心情 阅读(76823) 评论(0) 推荐(1)
JQuery判断radio(单选框)是否选中和获取选中值
摘要:一、设置选中方法 代码如下: $("input[name='名字']").get(0).checked=true; $("input[name='名字']").attr('checked','true'); $("input[name='名字']:eq(0)").attr("checked",'ch 阅读全文
posted @ 2017-11-21 12:38 幽默是一种心情 阅读(13014) 评论(0) 推荐(0)
jQ无法设置checkbox变成选中状态
摘要:设置以后checkbox并没有变成选中状态,用chrome调试看了一下,checkbox中确实有checked属性,针对这个问题,大家可以参考下本文 代码如下: $("input").attr("checked","checked") 设置以后checkbox并没有变成选中状态,用chrome调试看 阅读全文
posted @ 2017-08-17 00:09 幽默是一种心情 阅读(1789) 评论(0) 推荐(0)
JQuery实现页面跳转
摘要:$(function(){ var pn = $("#gotopagenum").val(); //#gotopagenum是文本框的id属性 location.href = "NewList.aspx?pagenum="+pn; //location.href实现客户端页面的跳转 }); 阅读全文
posted @ 2017-08-12 09:30 幽默是一种心情 阅读(21020) 评论(0) 推荐(1)