Reputation: 2362
I am doing MVC App. I have a View that call a Partial View as DialogPopUp.
That View execute a @Ajax.BeginForm
. On Success it calls a javascript function defined in Parent View
becouse there are not allow javascript un PartialView.
That function makes <div hiddden>
visible, and viceversa.
$(".hidden").toggleClass("hidden visible");
the problem I found, that I have <div hiddden>
also in Parent View. So, when function is called, is works on both divs...(in Parent and in PartialView).
Is there a way that it is ejecuted only in PartialView?
Upvotes: 0
Views: 168
Reputation: 1038850
You could wrap your partial view contents in a div:
<div class="myPartialWrapper">
... your partial markup comes here
</div>
and then adapt your selector:
$(".myPartialWrapper .hidden").toggleClass("hidden visible");
Upvotes: 1