Am I mistaken, or does the string have to match exactly in this case?  In
other words href="http://www.notthis.com"; will return false, while
href="http://notthis.com/directory/file"; will return true.

Adam



Jonathan Sharp wrote:
> 
> On 12/14/06, Dave Methvin <[EMAIL PROTECTED]> wrote:
>>
>> *SNIP*
>> It would be nice if there was a $().grep() to filter the elements:
>>
>> $("[EMAIL PROTECTED]:not(.thickbox)").grep(function(){
>>     for ( var i=0; i < notthese.length; i++ )
>>         if ( this.href == notthese[i] ) return false;
>>     return true;
>>   }).bind("click", function(){ return !window.open(this.href); });
>>
>> But that doesn't exist. There's a jQuery.grep but it can't be used in a
>> chain.
> 
> 
> I looked at 1.0.3 source and filter() accepts a function and it appears
> that
> if that function returns true the element is included otherwise it returns
> false. The function you define takes two args: element, and i with i being
> the position in the current list or stack.
> 
> (Untested)
> $("[EMAIL PROTECTED]:not(.thickbox)").filter(function(el){
>     for ( var i=0; i < notthese.length; i++ )
>     if (el.href == notthese[i] ) return false;
>         return true;
>     }).bind("click", function(){ return !window.open(this.href); });
> 
> Cheers,
> -js
> 
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Change-href-of-external-links-tf2718387.html#a7878878
Sent from the JQuery mailing list archive at Nabble.com.


_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to