You can satisfy condition 1 and 3 with this:

$('a:not([href*=javascript])[target!=_blank]')

But it's not that easy for nº 2. What is saved on the onclick
attribute is a function, not plain text. You can see the source code
of the function with the .toString() method, so you could do this:

$('a:not([href*=javascript])[target!=_blank]').filter(function(){
 return this.onclick
         ? this.onclick.toString().indexOf("return false") < 0
         : true;
});

Or put it all in the filter function to get slightly better
performance:

$('a').filter(function(){
    return (
        this.href.indexOf("javascript") < 0
        && this.target != "_blank"
        && (this.onclick ? this.onclick.toString().indexOf("return
false") < 0 : true)
   );
});

Note that the '@' for attribute selectors have been deprecated for a
long time and support for it removed in 1.3.2 (it won't work at all).

cheers,
- ricardo
On Mar 7, 6:57 am, "rahman...@gmail.com" <rahman...@gmail.com> wrote:
> i want to select "a" tags that :
>    1.it's href dos not contain "javascript:"
>    2.its onclick attribute dos not contain "return false"
>    3. and it's target is "not _blank"
>
> i wrote this rules with jQuery like this 2 codes but it's not working
> true, where is my problem ?!
>
> 1.
>   $("A :not('a...@onclick*=\"return false\"]' , a...@href^=\"javascript:
> \"] , a...@target=\"_blank\"] )")
>
> 2.
> $("A").not("a...@target='_blank']").not("a...@onclick*='return
> false']").not("a...@href^='javascript:']")
>
> thanks before

Reply via email to