【问题标题】:Can I set delegate for input textfield in UIWebView?我可以在 UIWebView 中为输入文本字段设置委托吗?
【发布时间】:2012-05-24 02:32:40
【问题描述】:

我正在使用 PhoneGap 在 iOS 上进行开发和应用。在UIWebView的HTML内容中,有一个输入文本框<input />

我的问题是我可以知道这个<input /> 文本字段的操作,例如textFieldDidEndEditing: 吗?或者我可以为此<input /> 文本字段设置委托。如果可能,请告诉我如何。非常感谢。

【问题讨论】:

    标签: ios uiwebview cordova textinput uitextfielddelegate


    【解决方案1】:

    您可以在 UIWebView 中获取 HTML 输入的 onchange 事件

    <input type="text" onchange="changeEvent(this)" id="myInput">

    <script>
    function changeEvent(ele) {

    alert(ele.value);

    }
    </script>

    【讨论】:

    • 我希望 AppDelegate 监听和处理事件,而不是 HTML 本身。
    猜你喜欢
    • 2011-05-19
    • 1970-01-01
    • 2014-02-28
    • 1970-01-01
    • 2023-04-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多