I need small help with jquery.
EDIT:
echo "<li> ";
echo $navi_menu->navi_name;
echo "<ul>";
and the Jquery to it was,
<script type="text/javascript">
$(document).ready(function () {
$("#nav li:has(ul)").click(function (event) {
if (this == event.target) {
$(this).toggleClass('clicked').children('ul').slideToggle();
$(this).find('li:has(ul)').removeClass('clicked').find("ul").slideUp();
$(this).siblings().removeClass('clicked').find("ul").slideUp();
}
}).addClass('has_ul');
});
</script>
This used to toggle up and down...now i have added a href tag in my html, instead of printing naviname(echo $navi_menu->navi_name; ) directly, i want a link to it. I need help to rewrite the jquery to accomdate a href wherever li tag comes....
echo "<li> ";
echo "<a class=\"click\" href=\"display_mod.php?navi_id=".$navi_menu->navi_id."\">$navi_menu->navi_name</a>";
switch($navi_menu->navi_id) {
case 1:
echo "<ul>";
and the jquery to it was,
<script type="text/javascript">
$(document).ready(function () {
$("#nav li:has(a.click):has(ul)").click(function (event) {
if (this == event.target) {
$(this).toggleClass('clicked').children('ul').slideToggle();
$(this).find('li:has(a.click):has(ul)').removeClass('clicked').find("ul").slideUp();
$(this).siblings().removeClass('clicked').find("ul").slideUp();
}
}).addClass('has_ul');
});
</script>
With the modifed jquery to accomdate a href tag is not working.
Here li tag is parent and ul is child and the chain continues.
(Part of the code is from cssplay.)