Need help on getting text from anchor!

Discussion in 'JavaScript' started by dreteh, Jan 12, 2010.

  1. #1
    Hello,

    I am using jquery to assign click event on a list of anchors by the following codes:

    ----html----
    <a href="#" class="myLink">some text</a>

    ----js----
    $('a.myLink').click(function(){
    alert(this.text);
    }

    I can display "some text" on firefox and chrome but not IE(at least doesn't work on ie 8). Can someone tell me how to read text for ie?
    Thank you.
     
    dreteh, Jan 12, 2010 IP
  2. dimitar christoff

    dimitar christoff Active Member

    Messages:
    882
    Likes Received:
    62
    Best Answers:
    0
    Trophy Points:
    90
    #2
    dimitar christoff, Jan 13, 2010 IP
  3. dreteh

    dreteh Member

    Messages:
    514
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    33
    #3
    Thank you dimitar. It works like a charm.
     
    dreteh, Jan 14, 2010 IP