Hello, I have a tree view based on < ul > and < li > tags.
I am trying to hide the branches based on filter text. Here is my show/hide code:
$("#filter").change(function(){
var tval=$(this).val();
$("li").show();
$("li").not(":contains(\'"+tval+"\')").hide();
$("li").is(":contains(\'"+tval+"\')").show();
})
The command: $("li").is(":contains(\'"+tval+"\')").show(); shows branches filtered by given tval, but if given < li > has a further children I would like to show them as well. How can I show all child elements if they exist?
kind regards Arman.
EDIT
example: search text A and we have D=>A=>C, D=>C=>C, A=>K=>S, so after filtering my tree should be: D=>A=>C, A=>K=>S. In the current implementation it will look like D=>A, A