在Javascript中使用document.getElementById的别名 [英] Make alias to document.getElementById in Javascript
本文介绍了在Javascript中使用document.getElementById的别名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何为函数document.getElementById
别名?我已经看到它使用$
谢谢
function $ 可能是最简单/最简单的方法: (id){return document.getElementById(id); };
How can I alias the function "document.getElementById" I've seen it done using $
Thanks
解决方案
Possibly the easiest/shortest way:
function $(id) { return document.getElementById(id); };
这篇关于在Javascript中使用document.getElementById的别名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文