javascript - Give function parameter before itself
问题描述
Is it possible calling element in function if I write that element before the function, example:
let demo = document.getElementById("demo")
demo.giveMeElement()
function demo() {
// How can I get that #demo element here
}
<div id="demo"></div>
解决方案
推荐阅读
- mysql - MYSQL:仅当用户不存在时才创建和授予权限
- cucumber - IntelliJ 黄瓜测试报告窗格 (UI) 未显示步骤定义
- python - Dictionary/For 循环只返回一个值?
- javascript - 如何为具有动态嵌套的数组赋值?
- paypal - 如何使用 PayPal v2 订单 API 以编程方式批准订单
- c# - NuGetFallbackFolder 路径在德语 Windows 上突然“错误”
- node.js - 如何测试使用 Jest 调用 API 的函数?
- node.js - OAuth2 idToken 已验证,但需要登录错误仍然存在
- python - Pandas DataFrame str.split() 错误:使用可迭代设置时必须具有相等的 len 键和值
- r - 组合for循环