radio button function using list
I'm using a list for selecting music genres. My function is this:-
$(document).ready(function(e) {
function checky() {
$(this).children("span").children(".icon-checkmark").stop().show();
$(".genre").not(this).children("span").children(".icon-checkmark:visible").stop().hide();
$(".searchfield").val($(this).attr('class')).keyup();
}
function checkn(){
$(this).children("span").children(".icon-checkmark").stop().hide();
$(".searchfield").val($(this).attr('class')).keyup();
}
$(".genre").toggle(checky, checkn)
});
This function is
CORRECT.
I want that when user clicks another genre directly after they clicking the previous genre, then also run the checkn function of the previous genre and then run the checky function of the genre clicked now.
How do I do that???
P.S. ".genre" is a list item, which has a text span which has a span containing checkmark icon.(Not related just proof that the code is correct.)