tags:

views:

59

answers:

2

Hello,

I have a url and I want to display only the html links or URLs using jQuery.

Thanks Jean

A: 

do the pattern match for url , whether the url is ending .html extenstion .

preg_match ( '/.html$/',$url ,$val );

pavun_cool
not quite, I want to get all the .html inside an html file
Jean
@Jean, please give more info on what you want to do, 'cause I don't know what you are trying to achieve.
Natrium
@natrium I have a html file, and I want to get all .html links to create a bookmark
Jean
+3  A: 

Taking a wild, wild stab in the dark here, hopefully hitting something that comes close to what you're really asking. This selector will get all links on the page that end with '.html':

$('a[href$=.html]').each(function () {
    alert(this);
    // do whatever you want to do with 'this'
}

http://api.jquery.com/category/selectors/attribute-selectors/

deceze
this does not work
Jean
@Jean It *does* work. If it doesn't work for *you*, you may consider clarifying *what* doesn't work or add more background info on what your situation is and what the end goal is supposed to be.
deceze