Magento 2 – How to Modify

Best Answer

Your code bind the click event only to the elements that exist at the time of binding. Replace your test.js code with below one:

require(['jquery'], function ($) {
    $(document).on("click","input[id^='btn-test']", function () {
         console.log('click');
    });
});