jquery一些问题
1、select禁止下拉:
(1)查询的列表为空。
(2)加上属性:$("#selectRows").attr("disabled","disabled");
赋值选择的option:
$("#exfinancingClassifyth").html($("#exfinancingClassify").find("option:selected").text());
判断:
<option value="9" <c:if test="${order.status==9}">selected="selected"</c:if>>已删除</option>
2、a标签去除点击事件
(1)removeAttr('href');
(2)removeAttr('onclick');
3、span赋值内容:$("#spanOne").text(“内容”);
修改span弹出文案:$("#spanOne").html(“内容”);
4、窗口居中:$("#div1").center();隐藏:$("#div1").hide();
5、正则匹配(手机):
var reMobile=/^((13[0-9])|(14[0-9])|(15[0-9])|(17[0-9])|(18[0-9]))(\d{8})$/; if(!reMobile.test(mobile)){ }
6、获取根路径:
//获取当前网址,如: http://localhost:8088/test/test.jsp var curPath=window.document.location.href; //获取主机地址之后的目录,如: test/test.jsp var pathName=window.document.location.pathname; var pos=curPath.indexOf(pathName); //获取主机地址,如: http://localhost:8088 var localhostPaht=curPath.substring(0,pos); //获取带"/"的项目名,如:/cms var projectName=pathName.substring(0,pathName.substr(1).indexOf('/')+1); return(localhostPaht+projectName);
7、h5发送短信倒计时:
//初始化 var interValObj; var count = 60; var curCount = 0; .... curCount=count; $('#smsCode').removeAttr('href'); $("#smsCode").text(curCount+"s后可以重发"); interValObj=window.setInterval(setRemainTime,1000); function setRemainTime(){ if(curCount==0){ window.clearInterval(interValObj); $("#smsCode").attr("href","javascript:getSmsCode()"); $("#smsCode").text("重新发送验证码"); }else{ curCount--; $("#smsCode").text(curCount+"s后可以重发"); } }
8、转化循环:
var result = eval('(' + data + ')'); var exfinancingList = result.exfinancingList; if(exfinancingList.length != 0){ $('#financingId').html(''); $.each(exfinancingList,function(index,element){ var option ="<option value='"+this.id+"'>"+this.title+"</option>"; $('#financingId').append(option); }); }
9、ajax的form表单对象提交:
$("#saveExfinancingJoinForm").serialize()
10、跳转页面对应div:
//其他页面 window.location.href = "<%= request.getContextPath()%>/wf/finance?fc="+ef+"#activityRule"; //本页面 window.location.hash = "#activityRule";
11、css赋样式:
$(".hint").css({"display":"block"});去除样式:
相关推荐
zrtlin 2020-11-09
xuebingnan 2020-11-05
wikiwater 2020-10-27
heheeheh 2020-10-19
Crazyshark 2020-09-15
softwear 2020-08-21
ZGCdemo 2020-08-16
jczwilliam 2020-08-16
littleFatty 2020-08-16
idning 2020-08-03
jinxiutong 2020-07-26
lanzhusiyu 2020-07-19
Skyline 2020-07-04
xiaofanguan 2020-06-25
Aveiox 2020-06-23
dragonzht 2020-06-17