undefinedfix
Sign in

After the input value changes, the click event cannot be executed normally [code update]

altegn0 edited in Thu, 14 Jul 2022

Closed state

Open state

But when you enter a value in the input box and clear it

Click on the small plus sign

clipboard.png

Normally, it should be the same as the diagram at the beginning. After reading the code written by others for a long time, I don't know where the problem is

The key codes are as follows

  $('.nodeSearch').change(function () {
         
          $(".zhangchang").hide();
          $(".guzhang").hide();
          $(".seachzhangchang").show();
          $(".seachguzhang").show();
          var searchText = $(this).val();
          //声明接受正常节点参数
          var $nodeRight = "";
          //声明接受故障节点
          var $nodeError = "";
          //判断当前是否有值,如果有则把以前的div隐藏
          if (!searchText) {
            //----------正常节点-----------
            $(".seachzhangchang").hide();
            $(".zhangchang").show();
             //----------故障节点-----------
            $(".seachguzhang").hide();
             $(".guzhang").show();
          } else {

This is the input listening event of the input box. I feel that it is the last place. When the input value is empty, $(". Guangzhou"). Show(); $(". Zhangchang"). Show(); this show method gives these two classes a display block attribute, so they are now blocks

The following is the click event of the stow button, because it only adds the open attribute to the parent. Because the display block has been added to the two classes above, there is no way to hide it

 $(".firstNode .glyphicon").click(function () {
      $(this).parent().toggleClass("open");
      })

clipboard.png

But because of the user experience, that show () Methods can't be deleted. How can we achieve the best compatibility

3 Replies
MaorBA
commented on Fri, 15 Jul 2022

Please show me

AsmaTalukder
commented on Fri, 15 Jul 2022

I didn't understand your problem description. Secondly, the code page you posted is too long. Even if you don't know where the key code is, at least remove the useless comments and post them again.

Ove
commented on Fri, 15 Jul 2022

Don't understand your problem, what effect, what effect appear, you can write a demo description, not necessarily paste the source code

lock This question has been locked and the reply function has been disabled.