change event on input search

change event on input search

AgurtzaneAgurtzane Posts: 8Questions: 3Answers: 0
edited March 2020 in Free community support

Hi!!
I need to access the change or click event of the input search in order to perform a certain action, close possible nested datatables.
How I do this? I have tried several ways, but I can't.
I've even tried this http://jsfiddle.net/marciosouzajunior/71yukww8/2/ in my code and it doesn't work

Thank you

Answers

  • kthorngrenkthorngren Posts: 21,167Questions: 26Answers: 4,921

    I think you want to use jQuery off() and .on() instead of bind() and unbind(). For example:
    http://jsfiddle.net/Lagenj8q/

    Kevin

  • AgurtzaneAgurtzane Posts: 8Questions: 3Answers: 0

    Hi!!
    With your solution, in my case, the event does not jump either. At the end, I managed to do it by indicating in the initComplete, as follows:

    this.api (). column (). each (function ()
    {
    $ ('. dataTables_filter: input [type = search]'). on ('keyup', function (e) {
    if ((e.keyCode! = 8) && (e.keyCode! = 37) && (e.keyCode! = 39))
    {
    close_details ();
    }
    });
    });

    Do you see any problem to this solution?

    Thank you

This discussion has been closed.