get the clicked link in wordpress using javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zadasani
    New Member
    • Dec 2011
    • 1

    get the clicked link in wordpress using javascript

    I have website with a side bar links like this

    Budget
    NAM
    Rules
    Contacts

    I want the link name
    When user clicks the link for example he clicked (Rules) JavaScript grabs the link name for me further compare it with an if or switch statement and open the specific page the user clicked.
  • omerbutt
    Contributor
    • Nov 2006
    • 638

    #2
    hi ,
    on the links
    Code:
    <a href="#." onclick='openPage(this.innerHTML)'>Link Name</a>
    use onclick and pass the innerhtml of the link to your function , thats it and you can carry on with comparing and opening a page
    regards,
    Omer Aslam

    Comment

    Working...