I am new here, sorry if I do some mistake with this question. I have a HTML code.
<a href="#" id="foo" class="one">hit me</a>
with this function i can add class two in class one
$(document).ready(function () {
    $('a#foo').click(function(){
            $('.one').toggleClass('two'); 
        });
    });
but how if I want to add class two if class two is not exist and do other function if class two is exist?
maybe like this,
<a href="#" id="foo" class="one">hit me</a>
i klik hit me and jquery is add class two,
<a href="#" id="foo" class="one two">hit me</a>
but when I klick hit me again, class two is not removed and because class is exist, i create other function based on class two is exist.
lets say like this,
i klik hit me
<a href="#" id="foo" class="one">hit me</a>
    <div id="blah" class=""*>lorem</div>
then
<a href="#" id="foo" class="one two">hit me</a>
<div id="blah" class=""*>lorem</div>
and klik hit me again.
<a href="#" id="foo" class="one two">hit me</a>
<div id="foo" class="blah2">lorem</div>
can you give me code or google suggest keyword or link, because I confused what i must search first.
thanks for adv, sorry for my Grammer, i cant speak/write English well, if any wrong grammer or language please correct me.


