【问题标题】:onblur and onfocus event in jquery sometime don't work properly on IE browserjquery 中的 onblur 和 onfocus 事件有时在 IE 浏览器上无法正常工作
【发布时间】:2019-11-22 11:52:23
【问题描述】:

我正在使用 onblur 和 onfocus 事件来调用函数以将文本框类型切换为密码或文本。

@Html.TextBoxFor(m => m.FinanceModel.VatNumber, new { @type = "password", @class= "form-control capitalize", maxlength = 30, @onblur = "setTypePassword(this);" , @onfocus = "setTypeText(this);" })

更改在 Chrome 浏览器上运行正常,但有时在 IE 浏览器上运行不正常。

【问题讨论】:

    标签: jquery razor


    【解决方案1】:

    IE 不允许您更改输入字段的属性类型。 但是你可以保留两个输入一个 type="password" 和另一个 type="text" 然后在焦点和模糊事件上显示隐藏 & 它适用于所有浏览器以及 IE :-)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-01-08
      • 2013-06-16
      • 1970-01-01
      • 2016-12-30
      • 2020-02-17
      • 2012-03-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多