JS,JQ Monitor the change of input value in time, click-Listen event of clear button in the input search box of MUI

Source: Internet
Author: User

Js:

document.getElementById ("Input object ID"). AddEventListener (' input ', function () {

Console.log ("AAAAA");

});

JQ:

$ ("input object"). Bind ("Input PropertyChange", function () {

Console.log ("AAAAA");
});

Click monitoring of the MUI Clear button:

MUI (' input object ') [0].addeventlistener (' Focus ', function () {

MUI (". Mui-icon-clear") [0].addeventlistener (' Tap ', function () {

Console.log ("AAAAA");

});

})

  Note: Because the Clear button in the MUI search box appears when the input box focus, that is, input gets the focus, if the focus listener event is not input, then the click event of the Clear button will not be heard.

I think it is because the clear button, the following span is the document after loading, the MUI JS loaded into the, so when the input focus event is not first listened to, the Purge button listener event is not found that DOM object, so will be reported such errors.

JS,JQ Monitor the change of input value in time, click-Listen event of clear button in the input search box of MUI

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.