change data-target bootstrap code example Example: how to add data modal target attribute in jquery $('#testButton').attr('data-target','#testModal2');