【问题标题】:Google closure get value from DOM elementGoogle 闭包从 DOM 元素中获取值
【发布时间】:2018-08-24 22:05:34
【问题描述】:

我在 ClojureScript 之上使用 Google 闭包,从 html 元素中的“选择”获取值的方法是什么?

我正在尝试:

(.value (gdom/getElement "select-combo"))

但我得到了:

Uncaught TypeError: goog.dom.getElement(...).value is not a function

我也尝试过“getValue”,但到目前为止没有运气。我在 Google API 文档中也找不到该函数。

使用jQuery应该是:

   $("#select-combo").val(); 

【问题讨论】:

  • 将呼叫更改为(.-value ...) 是否可以解决问题?
  • 你说得对!谢谢!

标签: clojurescript google-closure-library


【解决方案1】:

查看ClojureScript CheatSheet

你可以在本地获取一个值

(.-innerHTML el)

或者使用 cljs-oops 库:

(oget el "innerHTML")

【讨论】:

    猜你喜欢
    • 2018-11-29
    • 1970-01-01
    • 2016-02-21
    • 2022-12-05
    • 2014-11-24
    • 2022-01-17
    • 2014-02-13
    • 2012-12-10
    • 2018-12-17
    相关资源
    最近更新 更多