随笔分类 -  JQuery

摘要:var arr = [ { name: "张三", age: 20 }, { name: "", age: 30 }, { name: "李四", age: 25 } ]; var result = arr.filter(item => item.age > 25).some(item => !it 阅读全文
posted @ 2022-12-12 11:01 於生 阅读(1216) 评论(0) 推荐(0)
摘要:限制只能保留两位小数点 HTML: <input type="text" onkeyup="verify(this)"/> JS: function verify(obj){ obj.value = obj.value.replace(/[^\d.]/g,""); //清除"数字"和"."以外的字符 阅读全文
posted @ 2021-03-17 10:12 於生 阅读(841) 评论(0) 推荐(0)
摘要:比较常用有以下几种方式: //用href跳转 window.location.href = "https://www.cnblogs.com/lyso"; //用http的重定向来跳转 window.location.replace("https://www.cnblogs.com/lyso"); 阅读全文
posted @ 2021-03-05 11:48 於生 阅读(2271) 评论(0) 推荐(0)
摘要:$(this).parent(); // 父节点 $(this).parents(); // 全部父节点 $(this).children(); // 全部子节点 $(this).find(); // 返回父元素中的子元素 $(this).contents(); // 返回元素里面的所有内容,包括节 阅读全文
posted @ 2020-09-30 14:49 於生 阅读(746) 评论(0) 推荐(0)