doufu9836 2016-01-19 16:04
浏览 45

单击焦点和选项卡时,如何避免对文本框进行onChange事件调用?

I have few textboxes and an editbutton on a html page - say T1, T2, T3, T4. I have onchange event for T1. The onchange event makes T2 readOnly=true T3,T4 editable(sets readonly property = false)

Now, I have a button - "edit" - what it does is makes T2 readonly=false T3 and T4 uneditable(sets readonly property = true) and focus goes to T1.

Next, I am now at T1. I click tab(even without changing the value of T1) - and the problem arises - onChange event of T1 is fired! and it makes T2 readOnly=true T3,T4 editable(sets readonly property = false) which is undesirable.

How can I avoid onChange of T1 to fire on clicking tab from T1 when T1 is in focus? Any help on this is very much appreciated. Thanks in advance!

  • 写回答

2条回答 默认 最新

  • dongyou2279 2016-01-19 16:12
    关注

    I'm not quite sure what you're asking, but onchange might not be the correct function to be using. Make a fiddle or post your code if this doesn't fix it, but try replacing your onchange triggers with onfocus instead.

    http://www.w3schools.com/jsref/event_onfocus.asp

    评论

报告相同问题?

悬赏问题

  • ¥15 基于PLC的三轴机械手程序
  • ¥15 多址通信方式的抗噪声性能和系统容量对比
  • ¥15 winform的chart曲线生成时有凸起
  • ¥15 msix packaging tool打包问题
  • ¥15 finalshell节点的搭建代码和那个端口代码教程
  • ¥15 Centos / PETSc / PETGEM
  • ¥15 centos7.9 IPv6端口telnet和端口监控问题
  • ¥20 完全没有学习过GAN,看了CSDN的一篇文章,里面有代码但是完全不知道如何操作
  • ¥15 使用ue5插件narrative时如何切换关卡也保存叙事任务记录
  • ¥20 海浪数据 南海地区海况数据,波浪数据