2013-07-12 102 views
-8

I would like to remove all <a href> from a specific div.刪除全部<a href> from a specific div

<div class="postInfo"> 
    <a href> 
</div> 

I am trying

$('.postInfo href').remove(); 

that's not working. What am I doing wrong?

+1

'href' is not an element. You need to learn basic selectors. – SLaks

+1

The selector is the tag name which boils down to the first word after the opening '<' and the first word after the '...'它將是'a',就像'

...

'是'p'一樣。 (這是關於HTML的東西,你應該知道這是與JavaScript或jQuery的愚弄。) –

回答

6

target the anchor, not the href :

$('.postInfo a').remove(); 
+0

享受免費代表':P' – Bojangles

+0

@Bojangles - 我都「複製」了起來,所以它並不重要,因爲我無論如何,我還沒有得到它! – adeneo

+0

你是否沒有得到超過一定數額的代表?至少這就是你所暗示的 – Bojangles