2

In my symfony application i have a jquery $(document).ready function that looks like that:

$(document).ready(function (){
    var button = $(".addFieldButton");

    $(button).click(function (e){
        //... click function
    }
}

The thing is i can also add lines which contain a new .addFieldButton-Button which doesn't work because the function is only instanciated once when the document is loaded so i also want to reinstanciate this function when the user clicks the .addLineButton-Button like this:

$(document).on('mouseover mouseout','.addLineButton',function (){
    var button = $(".addFieldButton");

    $(button).click(function (e){
        //... click function
    }
}

But when i only use this function the .addFieldButton-Button that exists from the start on, only works when i hovered over the .addLineButton-Button. Is there a way to combine these to functions?

lxg95
  • 553
  • 2
  • 8
  • 28

0 Answers0