请问jquery是用来干什么的?

jQuery,嗯,刚开始的时候,一听到这个名字,我的心就猛地一跳,心想这不简单。
它就像一根魔杖,让那些繁琐的HTML文档操作变得简单,比如选择元素、添加元素、删除元素、更改元素。
之前使用的是原生JavaScript,编写起来比较费力,而且兼容性还是一个问题。
通过 jQuery,可以使用选择器,这更加方便。

再比如,以前写JavaScript的时候,你要写很多代码,但是现在你使用jQuery,一些方法调用、动画和表单处理,都正确高效地完成了。
当时我就很疑惑,为什么这么方便呢?后来我才知道,这就是jQuery的魔力。

说到Ajax交互,编写它曾经是非常复杂的。
jQuery一出现,就直接提供了一套方便的Ajax方法、异步请求、数据处理。
立即就完成了。
该网站反应灵敏,用户体验良好。
再好不过了。

此外,jQuery还可以解决跨浏览器的兼容性问题。
以前,编写必须兼容多种不同浏览器(例如 IE、Firefox、Chrome)的代码是一件令人头疼的事情。
现在有了 jQuery,它帮助我们解决了这些问题,开发者可以减少他们的担忧和努力。

总的来说,jQuery确实是前端开发的得力助手。
它可以简化任务、提高效率并确保兼容性。
是开发者必备的神器。
2 02 2 年,在我居住的某个城市,很多开发者都在使用 jQuery。
毕竟,谁不想让编码变得更容易呢?

jquery有什么作用?

jQuery,我已经习惯这个很久了。
I remember when I first started making websites in 2 008 , no frameworks were popular and writing JS was a headache. At the time, a client wanted to build a website with dynamic effects.我为此工作了半个月。
The code was written in a mess and it was compatible with different browsers.太累了。

Later I came in contact with jQuery in 2 009 , which opened the door to a new world. Take the jquery-1 .4 .2 .min.js you mentioned as an example.这是1 .4 .2 版本的压缩包。
All comments and spaces have been removed, and the code has been compressed. It saves space when used in a formal web environment. I remember when I was working on a project, 1 .4 .2 was the mainstream version at the time. I used it to select elements, change styles and create animations. One line of code corresponded to the previous ten lines.
For example, if I want to change the style of a button, I used to write document.getElementById('btn').style.backgroundColor='red';. Now I use $('btn').css('background-color', 'red');.是不是容易多了? And the compatibility is good, no matter IE6 or FF, just write a set of code. At that time IE6 and FF3 were still everywhere and it would have been impossible without jQuery.
另一个例子是发出 AJAX 请求。
以前我无法处理XMLHttpRequest的各种参数,但现在$.ajax({url:'data.php', success:func})只需要几行代码就可以完成。
Later version 1 .5 came out and there were Deferred objects and asynchronous operation chain calls, which were simply artifacts. I remember when I built a large campaign site, I relied entirely on jQuery's Ajax+Deferred to streamline data requests and page rendering.
Plug-ins are even more convenient, such as easyUI and cycle plug-ins, which can be used by quoting them directly. I built a table management system that year that used easyUI to implement paging, searching, and editing with just a few lines of code.这比我手写的代码好多了。
At that time, there were many plug-ins on the Internet, including carousels, drop-down menus, form validation, and so on.
但是现在时代已经变了。
Later came new frameworks such as Zepto and Vue, and lightweights such as Umi.但如果要说jQuery的主要优点是其丰富的文档、众多的插件和简单的编写方法,那么它对于初学者来说尤其友好。
许多旧项目仍在使用。
For example, an old system our company took over last year is based on jQuery, which is easy to change.
你问它有什么作用?简单来说,就是: 1 . Select elements: much better than the original DOM selector 2 .改变风格:一行代码搞定 3 . Create animations: fade in, fade out, slide, etc. 4 . Respond to events: click, move the mouse into these 5 . 做AJAX:数据交互 6 . Good scalability: there are many plug-ins
But now the new frameworks also have their own advantages. If you want to say that it is completely easy to use, you really don't dare to say that. Each framework has its scenarios, it depends on what you want to do.