有没有一种简单的方法将jquery代码转换为javascript? [英] Is there an easy way to convert jquery code to javascript?

查看:689
本文介绍了有没有一种简单的方法将jquery代码转换为javascript?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有许多使用jQuery在javascript / dom中实现某些功能的例子。但是,使用jQuery并不总是能够理解用jQuery编写的javascript解决方案的例子。

There are lots of examples out there of achieving certain things in javascript/dom using jQuery. However, using jQuery is not always an option which can make understanding the examples of javascript solutions written in jQuery hard.

是否有一种简单的方法将jQuery代码转换为常规javascript ?我想无需访问或理解jQuery源代码。

Is there an easy way to convert jQuery code to regular javascript? I guess without having to access or understand the jQuery source code.

推荐答案

最简单的方法是学习如何进行DOM遍历使用普通的DOM api进行操作(你可能会称之为:普通的JavaScript)。

The easiest way is to just learn how to do DOM traversing and manipulation with the plain DOM api (you would probably call this: normal JavaScript).

然而,这对某些事情来说可能是一种痛苦。 (这就是为什么库首先被发明的原因。)

This can however be a pain for some things. (which is why libraries were invented in the first place).

谷歌搜索javascript DOM遍历/操纵应该会给你带来很多帮助(有些不太有用)资源。

Googling for "javascript DOM traversing/manipulation" should present you with plenty of helpful (and some less helpful) resources.

本网站上的文章相当不错: http://www.htmlgoodies.com/primers/jsp/

The articles on this website are pretty good: http://www.htmlgoodies.com/primers/jsp/

正如Nosredna在评论中指出的那样:一定要全部测试浏览器,因为现在jQuery不会为你处理不一致。

And as Nosredna points out in the comments: be sure to test in all browsers, because now jQuery won't be handling the inconsistencies for you.

这篇关于有没有一种简单的方法将jquery代码转换为javascript?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆