I've a <div>, in which I'm adding <input> and an <a> dynanically using jQuery.
Like this:
<div> is getting filled when addServicePanel() is called:
function addServicePanel() {
    var wrapper = $(".main_wrapper"); //Fields wrapper
    var add_button = $(".add_ele_button"); //Add button ID
    var x = 1; //initlal text box count
    $(add_button).click(function (e) { //on add input button click
        e.preventDefault();
        if (x < max_fields) { //max input box allowed
            $(wrapper).append('
                <div class="service_parent_div">
                    <div class="myContainer">
                        <div class="myPipeline">
                            <div class="form-group">
                                <label class="col-md-4 control-label">Pipeline</label>
                                <div class="col-md-4">
                                    <input id="pipeline" name="pipeline" type="text"/> </div>
                                    <a href="#" class="add_field_button">Add Board (+)</a> </div>
                        </div>
                        <div class="input_fields_wrap"></div>
                    </div>
                </div>
            '); //add input box
        }
    });
}
Function I've already written to work with .add_field_button:
function addSubPanel() {
    var max_fields = 40; //maximum input boxes allowed
    var wrapper = $(".input_fields_wrap"); //Fields wrapper
    var add_button = $(".add_field_button"); //Add button ID
    var x = 1; //initlal text box count
    $(add_button).on("click", this, function (e) { //on add input button click
        alert("<a> cliked"); // THIS IS NOT GETTING CALLED
        e.preventDefault();
    });
}
When I click on the <a> tag, I want a function to be called, which I've already written in my js file.
Issue I'm facing is that fucntion is not getting called when I click .
I think it is because on page load, the element is not rendered yet, so nothing is binded with that function.
How can I fix it?
Thanks
 
     
    