简体   繁体   中英

how to unbind a hyperlink for a label with the anchor tag?

I have a label inside the link tag. I did it for purpose to reference some other script. I want to remove just the hyperlink for that label .

<a href="/" title="Go to homepage">
<label for="enr_rds_batch_update_Section" id="section">Section</label>
<img alt="Look up Questions" class="image_section_search" src="/assets/Search-icon.gif" title="Lookup Questions">
</a>​

Thanks!!

Just use the jQuery .unwrap() function.

The line you care about is:

$('#section').unwrap();

Just put that in a place that gets called when you want to remove the a tag.

Fiddle: http://jsfiddle.net/gromer/6YSQQ/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM