【问题标题】:scala Liftweb - retrieving content of tagscala Liftweb - 检索标签的内容
【发布时间】:2016-12-22 06:09:18
【问题描述】:

我是新手,所以问题是: 我有一个 div 和一个 textarea 。我也有一个按钮,我想在不刷新页面的情况下获取#code textarea内容(其实并不重要) 我尝试了很多谷歌搜索,但 4 页没有答案:C 请帮忙! <div lift="Snippet.button"> <textarea id="code"> xdxdxdxdxd xhere goes the code </textarea> <br /> <button class="btn btn-default" id="but"> Submit </button> <input type="hidden" id="hidden"> </div>

【问题讨论】:

    标签: javascript html scala lift


    【解决方案1】:

    在解析了很多网站几个小时后,我发现了一些东西:

    JE.ValById("#code") - 返回 textarea 或任何输入的值

    JsCmds.SetValById("#code", "test value") - 将 vlaue 设置为找到的元素

    【讨论】:

    • 值得注意的是:所有这些都是在客户端生成 JavaScript。所以另一个答案可以是在客户端写JS,通过调用函数或者调度事件的方式与之通信。请参阅in this mailing list post 描述的方法——它可以用于彗星或 AJAX 通信。
    猜你喜欢
    • 2019-05-10
    • 1970-01-01
    • 1970-01-01
    • 2014-05-14
    • 2016-05-15
    • 1970-01-01
    • 2018-11-06
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多