Solved

Looking to target the a tag and remove its functionality

Posted on 2012-04-09
1
176 Views
Last Modified: 2012-04-30
Looking to target the a tag and remove its functionality, either remove the onclick or disable the link.

This is an override to html that I cant edit, so adding a class or id to the text will not work. How can I target the link using the mootools framework without add a class or id to the html.

Thanks for your help.


          <div id="hglink">
              <span id="linklabel"></span>
                <a href="javascript:;" onclick="toggleDiv();this.blur();return false;">
                    <span id="linktext">Enter Address</span>
                    <span id="hgzip"></span>
              </a>
          </div>
0
Comment
Question by:yando18
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 20

Accepted Solution

by:
Proculopsis earned 500 total points
ID: 37823765
Check out this jsfiddle.

jQuery(document).ready(function() {
    $("button").click(function() {

        $("#hglink a").removeAttr("onclick");
        $("#hglink a").removeAttr("href");

    });
});

Open in new window

0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question