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


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 () {
          var searchText = $(this).val();
          var $nodeRight = "";
          var $nodeError = "";
          if (!searchText) {
          } 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 () {


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

3 Replies
commented on Fri, 15 Jul 2022

Please show me

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.

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.