美文网首页
js的常用方法

js的常用方法

作者: 陈庆香 | 来源:发表于2018-08-06 15:30 被阅读0次

js 常用方法

modal框清楚缓存

$("#modal").click(function(){

//清除bootstrapValidator校验缓存

$(".lessonHourBase_validator").data('bootstrapValidator').resetForm();

//清除maodal缓存数据

//清除文本框

$("input[type='text']").val("");

//让下拉框中输入的文本值是下拉框中第一个option的文本值

$("#lesson_hour_type_div").find(".select2-chosen").html($("#lesson_hour_type option:first").text());

//清除radio,默认选择第一个radio

$(".addlesson_pointRadio input[type=radio]").eq(0).prop("checked", true)

//清除li表

$("#add_point").find("li").remove();

js清除数组中的值

pointArr = []

if(pointArr.length!=0){

pointArr.splice(0,pointArr.length)

}

js数组中添加元素

pointArr.push()

js滤空

$.trim();

});

json字符串转换成json对象

eval(jsonStr)

$.parseJSON(jsonStr)

json对象转换成json字符串

JSON.stringify(knowledgePointArray)

//获取下拉框中选择的元素

$("#select_id option:selected").val(); 

//获取被选中的radio

$(".addlesson_pointRadio input[type=radio]:checked").val()

//遍历列表 获取选取的列表的索引

$("#update_point li").each(function(index,item){

alert($(this).parent().in

相关文章

  • JavaScript数组常用方法

    目录 JS 数组常用API常用属性常用方法常见方法语法解释from方法isArrayconcateveryfill...

  • js基础了解

    js数组常用遍历方法使用: js数组常用操作方法使用: 基本逻辑运算: 基本字符串操作方法:

  • vue axios cdn 封装

    1.config.js 常用域名封装: 2.utils.js 常用的方法封装: 3.api.js axios接口...

  • JsUtil

    一些常用的JS方法

  • 2016-08-05学习笔记

    JS简介 循环 方法一:if goto 常用 方法二:while 常用 方法三:for 常用 同一个变量不能申明...

  • js 常用方法总结

    字符串的常用属性,概览 Array对象的方法; 详细js数组常用方法大全

  • 小程序-常用utils

    小程序-常用utils,整理常用的小程序js工具方法 剔除回车键 utils.js const delEnter ...

  • Recent Problems

    document.createElement创建的元素有哪些属性和方法。其他常用JS原生DOM方法。 Vue.js...

  • 移动排版巨好用的:better-scroll

    纵向的排版 HTML: css: JS: 横向排版 HTML CSS JS 常用方法 refresh(); =>重...

  • 日期格式化等方法

    日期格式化和其他常用方法插件 src/assets/js/dateFilter.js 使用方法 直接在js中调用方...

网友评论

      本文标题:js的常用方法

      本文链接:https://www.haomeiwen.com/subject/cskgvftx.html