Reputation: 1100
What i did so far:
Step1: installed "jQuery.UI.Combined" via NuGet
Step2: In my Razorpage I include this code:
<script src="~/lib/jquery/dist/jquery.js" type="text/javascript">
$(document).ready(function () {
$("#test").click(function () {
$("#NavBar_OptionPanel").toggle();
});
});
</script>
Step3: This is my Button:
<a id="test">Settings</a>
Step4: This is the Panel i want to toggle on/off:
<div id="NavBar_OptionPanel">
<label>Options</label>
</div>
What i expected: When clicking on an element with id="test", all elements with id="NavBar_OptionPanel" should toggle on/off
But nothing is happening. So i guess there could be two problems:
Can you help me?
Upvotes: 0
Views: 2360
Reputation: 586
You have your code inside your script tag including jquery, change it to this:
<script src="~/lib/jquery/dist/jquery.js" type="text/javascript"></script>
<script>
$(document).ready(function () {
$("#test").click(function () {
$("#NavBar_OptionPanel").toggle();
});
});
</script>
Upvotes: 4