Is jQuery Still Relevant in 2018?
DOM Selection
$('.someclass')
document.querySelector('.someclass')
document.querySlectorAll('.someclass li')
DOM Manipulation //操作 操纵
$element.remove()
$element.prepend(otherElement)
$element.before(otherElement)
$element.addClass('someClass')
$element.removeClass('someClass')
$element.toggleClass('someClass')
const parent = $element.parent()
const cloned = $element.clone()
Vanilla: //普通的
element.remove()
element.prepend(otherElement)
element.before(otherElement)
element.classList.add('someClass')
element.classList.remove('someClass')
element.classList.toggle('someClass')
element.classList.toggle('someClass')
const parent = element.parentNode
const colined = element.cloneNode(true)
element.prepend(Other)
Events
$someElement.on('click',function(e){
//Logic
});
someElement.addEventListener('click'.e=>{
//Logic
});
HTTP Requests/Ajax
jQuery was MUCH easier than using the XHR object to make ajax calls.Now we have Fetch and other specialized libraries.
fetch('http://api.something.com')
.then(res => res.json())
.then(data => console.log(data))
axios.get('http://api.something.com')
.then(res => console.log(res,data))
Utilities
$.isArray(someValue) Array.isArray(someValue)
$.inArray(item,anArray) someArray.indexOf(item) < -1
$.each(someArray,(index,value)=>{}) someArray.forEach((value,index)=>{})
$.map(someArray,(value,index)=>{}) someArray.map((value,index)=>{})
$.grep(someArray,(value,index)=>{}) someArray.filter((value,index)=>{})
$.parseJSON(str) JSON.parse(str)
Animations
Animation with Vanilla JS only is one thing that is MUCH more difficult than with jQuery but there are many other options
·CSS Transitions/Keyframes
·Web Animation API
·3rd party libraries like Greensock



Not about the future but now.


Is jQuery Still Relevant in 2018?的更多相关文章
- Jquery动态设置下拉框selected --(2018 08/12-08/26周总结)
1.Jquery动态根据内容设置下拉框selected 需求就是根据下拉框的值动态的设置为selected,本以为很简单,网上一大推的方法,挨着尝试了之后却发现没有一个是有用的.网上的做法如下: &l ...
- 2018.7.5 jQuery学习
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8&quo ...
- 2018.2.28 PHP中使用jQuery+Ajax实现分页查询多功能如何操作
PHP中使用jQuery+Ajax实现分页查询多功能如何操作 1.首先做主页Ajax_pag.php 代码如下 <!DOCTYPE html> <html> <head& ...
- 2018.11.30 spoj220 Relevant Phrases of Annihilation(后缀数组+二分答案)
传送门 代码: 先用特殊字符把所有字符串连接在一起. 然后二分答案将sasasa数组分组. 讨论是否存在一个组满足组内对于每一个字符串都存在两段不相交字串满足条件. #include<bits/ ...
- jQuery选择什么版本 1.x? 2.x? 3.x?
类似标题:jQuery选择什么版本?jquery一般用什么版本?jquery ie8兼容版本.jquery什么版本稳定? 目前jQuery有三个大版本:1.x:兼容ie678,使用最为广泛的,官方只做 ...
- 解密jQuery内核 DOM操作
jQuery针对DOM操作的插入的方法有大概10种 append.prepend.before.after.replaceWith appendTo.prependTo.insertBefore.in ...
- 【菜鸟学习jquery源码】数据缓存与data()
前言 最近比较烦,深圳的工作还没着落,论文不想弄,烦.....今天看了下jquery的数据缓存的代码,参考着Aaron的源码分析,自己有点理解了,和大家分享下.以后也打算把自己的jquery的学习心得 ...
- 多个插件依赖不同版本jQuery问题解决案例
<script src="../../../js/jquery-1.3.2.min.js" type="text/javascript">< ...
- 转:jQuery.data
原文地址:http://www.it165.net/pro/html/201404/11922.html 内存泄露 首先看看什么是内存泄露,这里直接拿来Aaron中的这部分来说明什么是内存泄露,内存泄 ...
随机推荐
- 微信小程序:获取地理定位和显示相应的城市名称。
最近在看微信小程序,遇到地理定位显示城市名称的问题.本文就是记录这一过程. 解决方案 ...
- Project Euler 13 Large sum
题意:计算出以下一百个50位数的和的前十位数字. /************************************************************************* ...
- [USACO08FEB]修路Making the Grade 动态规划
对的\(n^3\)的程序调了一个月了,惊了... HSZ学oi\(\Longleftrightarrow\)闭眼学oi 要不是翻旧账还看不见.. 这是有\(n^2\)做法的. 参见LYD的书P244 ...
- jenkins 自动化部署
Execute shell Command BUILD_ID=DONTKILLMEif [ ! -d "/usr/jenkins/$JOB_NAME" ]; then mkdir ...
- 【codeforces 807C】Success Rate
[题目链接]:http://codeforces.com/contest/807/problem/C [题意] 给你4个数字 x y p q 要求让你求最小的非负整数b; 使得 (x+a)/(y+b) ...
- RobotFrameWork+APPIUM实现对安卓APK的自动化测试----第五篇【AppiumLibrary校验函数介绍】
http://blog.csdn.net/deadgrape/article/details/50619050 以上连作者先跪一下方便面,在上一篇中,作者遗漏了两个常用的函数: 1.长按 Long P ...
- AJAX发送POST请求,请求提交后Method从POST变成GET
服务器如果返回301或者302状态码,所有请求方法都会切换成GET头部的location如果要保证重定向后的请求方法,需要在服务端返回307(临时)或者308(永久)状态码,这两个状态码不会更改原请求 ...
- mybatis批量插入、批量删除
mybatis 批量插入 int addBatch(@Param("list")List<CustInfo> list); <insert id="ad ...
- Project Euler:Problem 88 Product-sum numbers
A natural number, N, that can be written as the sum and product of a given set of at least two natur ...
- .NET开源的背后:是无奈,还是顺应潮流?
摘要:微软.NET的开源,让很多开发者欣喜若狂.同一时候也有很多人好奇其背后的故事,过去视开源为癌症的微软为什么会突然有这一举措,是出于无奈,还是顺应潮流,而这当中的种种也许能够用文中的六个观点来说明 ...