I have a main view calls Index which contains some textboxes and allow additional textboxes to be added to the screen via partial view calls. The main view reference a js file which has the following code:
External JS file:
$("input[type='text']").on("change", function () {
alert("here");
});
The code works whenever I modify a value in a textbox loaded by the main view. However, it does nothing when I attempted to change the value from a textbox that is added by partial view.
Per my understanding, the live() method should handle the current element in the dom and any future element added to the dom. This is now being replaced with .on(). Hence, I'm using .on(). Is there anything new that is replacing .on() that I don't know of? .live() and .on() don't work in my case.
For good practices, I don't want to have the js/jquery code added to the partial view again to make it works. I'm hoping to avoid redundancy and implement good practices. Any help is appreciated.