jq常用用法集合
获取标签(xx指标签id)
$(“#xx option:selected”).val();
$(“#xx”).find(''option:selected").val();
$(“#xx”).val();
$(“标签名 [name=‘属性名称’]”).val()
input输入框禁止显示历史记录
autocomplete=“off”
循环获取
$(table).find(“tbody tr”).each(function() {
id = $(this).find(“input”).val();
userName = $(this).find(“span”).text();
});
清空/删除指定元素下的所以子节点或是内容
$(“#xx”).empty();
input的checked被选中
$(‘#xx’).is(‘:checked’)
$(‘input:radio[name=“userType”]:checked’).val();
长方形设置两头椭圆写法
.css3-parallelogram{
width:71px;height: 30px;color: #D0E6F7;border-radius: 100px;background-color: #555555;float: left;
}
使用如下
123131
显示效果如下
laydate限制起止日期
var startRender = laydate.render({
elem: '#applyStartTime',
type:'datetime',
format:'yyyy-MM-dd',
trigger: 'click',
done: function (value, date) {
if (value == "") {
date = {year: 1900, month: 0, date: 0, hours: 0, minutes: 0, seconds: 0};
}
endRender.config.min = {
year: date.year,
month: date.month - 1,
date: date.date,
hours: date.hours,
minutes: date.minutes,
seconds: date.seconds
};
}
});
var endRender = laydate.render({
elem: '#applyEndTime',
type:'datetime',
format:'yyyy-MM-dd',
trigger: 'click',
done: function (value, date) {
if (value == "") {
date = {year: 2099, month: 12, date: 31, hours: 23, minutes: 59, seconds: 59};
}
startRender.config.max = {
year: date.year,
month: date.month - 1,
date: date.date ,
hours: date.hours,
minutes: date.minutes,
seconds: date.seconds
};
}
});
前端模拟disable属性效果,可提交并传参
<style>
.disable-class {
background-color: #f5f5f5;/*背景色*/
color:#848484;/*字体颜色*/
border: 1px solid #d5d5d5;/*边框*/
cursor: default;/*鼠标指针光标样式*/
pointer-events: none;
}
</style>
前端点击事件
var inputArr = document.getElementsByClassName("groupTipsTitle");
for(var i=0;i<inputArr.length;i++){
inputArr[i].onclick = function(){
var cgroupcode= this.getAttribute('cgroupcode');
if(cgroupcode!=null && cgroupcode=='st_purchaseorder_body_page_base'){
document.getElementsByClassName('wui-button switch_button')[0].style.display = 'none';
document.getElementsByClassName('wui-button switch_button')[0].nextElementSibling.style.display='none';
}
}
}
隐藏元素
var c1= document.getElementsByClassName('wui-button switch_button')[0].style.display = 'none';
var c2= document.getElementsByClassName('wui-button switch_button')[0].nextElementSibling.style.display='none';