javascript - Bootstrap Toggle attribute for audio -


i want make attribute toggle.

this code:

javascript :

myfunc(mute){     var classname=a.getattribute("class")     if(classname=="glyphicon glyphicon-volume-up"){         a.classname="glyphicon glyphicon-volume-off"     }     else{         a.classname="glyphicon glyphicon-volume-up"     } 

html :

<li><a onclick="myfunc(mute)" href="#" id="mute" style="font-size:20px;" class="glyphicon glyphicon-volume-up"> </a></li> 

now, want do?

first, music plays, nobody likes it, , if person clicks on attribute want change class to: glyphicon glyphicon-volume-off. so, second click want glyphicon glyphicon-volume-up. however, understand. mute button.

oh, resolved!

javascript:

$(document).on('click','.toggleaudio',function(){     $(this).children().toggleclass("glyphicon glyphicon-volume-off glyphicon glyphicon-volume-up"); }); 

Comments

Popular posts from this blog

routing - AngularJS State management ->load multiple states in one page -

python - GRASS parser() error -

Swift game error message -