How to detect Link in a Tab is activated or clicked

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • maminx
    New Member
    • Jul 2008
    • 77

    How to detect Link in a Tab is activated or clicked

    i want to detect Link in a Tab is activated or clicked from my code. here the situation


    I have tabs that have link to web pages like example below :

    Code:
    <ul id="tabs">
    <li><a href="http://www.asdf.com"/><span>asdf</span></a></li>
    <li><a href="http://www.dddd.com"><span>dddd</span></a></li>
    And to detect that link is activated, i make this code below :
    Code:
    <script type='text/javascript'>
    $('a').click(function(){
        alert('activated');
    });
    </script>

    but it's show an error : $ is not defined

    any idea??

    thanks, regards : maminx
  • RamananKalirajan
    Contributor
    • Mar 2008
    • 608

    #2
    Hi Maminx,
    This error is due to that you have used '$' which is a element in prototyope framework. It gives the object reference. Wether have you included the prototype framework in your code? Eventhough there is no id --> 'a' in your html code. $ is just a replacement for document.getEle mentById();

    Thanks and Regards
    Ramanan Kalirajan

    Comment

    Working...