Solved

Looking to target the a tag and remove its functionality

Posted on 2012-04-09
1
171 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
1 Comment
 
LVL 20

Accepted Solution

by:
Proculopsis earned 500 total points
Comment Utility
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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this tutorial viewers will learn how to position overlapping items using z-index in CSS. They will also learn the restrictions on the z-index property.  Create a new HTML document with an internal stylesheet.: Create a div in CSS and name it Red.…
In this tutorial viewers will learn how to style elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now