aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes How can I select elements of body which are not children of a link tag with Sizzle/Javascript Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "How can I select elements of body which are not children of a link tag with Sizzle/Javascript" Watch "How can I select elements of body which are not children of a link tag with Sizzle/Javascript" New topic
Author

How can I select elements of body which are not children of a link tag with Sizzle/Javascript

sinan goker
Greenhorn

Joined: Apr 21, 2012
Posts: 1
I am newbie in both JS and Sizzle, trying to implement a system
that generates links according to a keyword like Google AdSense do.
I ve searched and decided to use Sizzle CSS Selector for this.

I have an html document and a keyword, I want to search all keywords in
the document body which are not in a link(a, area, etc.) tag.

Sample content



Selector code and replace operation


After changing keywords with links, the output content is



It changes all keywords in the document. The second keyword would not be changed according to my system. Because it has 2 "a" tags like <a><a></a></a>
I need a selector to select elements which are not childen of any link tags.

Any idea?
Thanks.






Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You probably want to use the not selector.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How can I select elements of body which are not children of a link tag with Sizzle/Javascript