I have written a wordpress plugin where I print main stream and when a user click main stream, it toggles the subjects belong to main stream. However, it works for the front end.
I wanted to implemnt this in wordpress backend also. Every thing works except the toggle function.
I have included jquery in admin-header file in wordpress.
<link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
<script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script>
<script type="text/javascript">
$(document).ready(function() {
// dynamically handlling main streams and their subjects
// when a main stream is selected, it is sub categories(subjects) div will
// be toggle.
// alert(subClicked);
$(".main_stream").click(function() {
var subClicked = $(this).attr('id');
// $(".stream").hide();
// alert(subClicked);
console.log("value is "+subClicked);
$("#" + subClicked + "sub").toggle();
});
});
</script>
I try to debug with firbug,though when I click the mainstream, it doesn't go in to $(".main_stream").click(function(). Nothing is changed.
Have I missed anything, I am new to wordpress. I am not sure how jquery is handle in wordpress admin panel. Can anybody give me a hint?
part of generated Html
<div id="Statisticssub" class="hide" "="" style="padding-left: 20px;">
<input type="checkbox" id="Technology_Solutions" value="" class="main_stream" checked="checked"/>
Technology Solutions
<br/>
<div id="Technology_Solutionssub" class="hide" style="display: block;" "="">
<div style="width: 350px; height: 30px; padding-top: 5px;">
<div style="width: 350px; height: 20px; padding-top: 5px;">
<div style="width: 260px; float: left; padding-top: 5px;">
<input type="checkbox" id="16" name="check_subjects[]"/>
C#
</div>
<div style="width: 75px; height: 10px; float: left; padding-right: 15px;">
</div>
<div style="width: 350px; height: 20px; padding-top: 5px;">
<div style="width: 260px; float: left; padding-top: 5px;">
<div style="width: 75px; height: 10px; float: left; padding-right: 15px;">
</div>
jQuery.Keep only one of them<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>.main_streamadded dynamically ?