Add Event To Dynamically Added Control
Introduction Sometimes in real world project we require that we can add html control dynamically to after page successfully rendered on browser. We also require to perform certain task such as register event based on requirement. In this article we learn about how we can register event on html control which was added dynamically using jquery. Two implement this type of demo first of all we require jQuery library you can download from Here . Html Snippet: <div class="container"> <div class="body-container"> <input id="btnNew" type="button" value="Add New Button" /> <ul class="parent-ul"></ul> </div> </div> JavaScript Snippet: $(function () { console.log("DOM is READy"); // button handler which is responsible for //adding new html control $('#btnNew').click(function () { var cnt = $('
Comments
Post a Comment