Here is my scenario…
i’m using partial views to load a page. To load to partial view on the page I use the JQuery method
$("#elementA").load("myMethod")
myMethod does an ajax call which returns my partial view with a list of objects. All this works fine. The problem is that inside one of my partial views i have a click event that should fire
$("#elementB").modal()
After i call
$("#elementA").load("myMethod")
the
$("#elementB").modal()
method does not respond…
The same
$("#elementB").modal()
works if i don’t use the load() function but then i dont know how to refresh the list after a new element is added to my database without using the $("#elementA").load("myMethod")….
I would apreciate any help with this. Thank you.
You need to make sure you have your click events bound using something like
on()(orlivein older versions of jQuery, thoughonis now preferred).This would ensure that any elements added to the page after the initial binding is made will also be subject to the same event handler.