.replace method in jquery

Posted by amit on Stack Overflow See other posts from Stack Overflow or by amit
Published on 2012-07-02T03:13:14Z Indexed on 2012/07/02 3:15 UTC
Read the original article Hit count: 183

Filed under:

i want to replace class me to old when user clicks on a tag, i want to do that only with .replace function. My purpose to learn how replace method work. But the function which i have made not working.

<head>

<script type="text/javascript" src="jquery-1.7.2.js"></script>


<script type="text/javascript">


$(function(){


    $('a').click(function(){

        $(this).attr('class').replace('me','old')


        })


    })



</script>


</head>

<body>

<a href="#" class="me">click</a>

</body>

© Stack Overflow or respective owner

Related posts about jQuery