Question for Jordan(jQuery)

In this section you can share self-made extensions with other users of WYSIWYG Web Builder.
There is a dedicated section for commercial extensions.
Post Reply
haakoo
 
 
Posts: 189
Joined: Fri Apr 25, 2008 8:02 am
Location: Groningen/NL

Question for Jordan(jQuery)

Post by haakoo »

He Jordan,

I'm trying to retrieve the href link from links(by class) and convert them to onclick
but I only get one(first one)

I know there's a part to use each in jquery,but can't make it work
Maybe,since you're not jquery illiterate :wink: ,can help me out.

I have 2 seperate links with normal href links,
Following is temp(onmouseover) code to see if the var shows-up and changes;

Code: Select all

function callUrl(){               
$('.style1').each(function (){
 var myUrl =$('a').attr('href'); 
                $("#Editbox1").val(myUrl)
});
}
jordan
 
 
Posts: 831
Joined: Tue Jun 26, 2007 1:56 pm
Contact:

Re: Question for Jordan(jQuery)

Post by jordan »

hi haakoo,

not quite understand how you want to use it ?
but a way to retrieve and store all (array used) could be …

var myUrl=new Array();
$('.style1').each(function(index,val){myUrl[index]=val.href});


then you could use the array myUrl[?] for whatever ie. $('#Editbox1').val(myUrl[0])
haakoo
 
 
Posts: 189
Joined: Fri Apr 25, 2008 8:02 am
Location: Groningen/NL

Re: Question for Jordan(jQuery)

Post by haakoo »

Hi Jordan,

Actualy i like to create an auto system to convert all href in textlinks by class into an onclick function
that way hrefs stay good for seo purposes and onclick for the action whatever;
like the dynamic iframe in your version 2 pack.
Since .js doesn't get indexed you could create another approach to the ajax!# hashbang by google.
I know you could apply events to text links(a very tedious approach)
But what if one uses the htmlbox-extension? no way to address anything at all
hint for an approach;
http://www.andrewpwatson.com/posts/crea ... ing-jquery
But first I need to get every used href in text

Hans
jordan
 
 
Posts: 831
Joined: Tue Jun 26, 2007 1:56 pm
Contact:

Re: Question for Jordan(jQuery)

Post by jordan »

haakoo wrote:But first I need to get every used href in text
hello haakoo,

well the above example does do that, it stores all href of the class style1 of the page into the array myUrl
ie.
myUrl[0] = 'http://www.wysiwygwebbuilder.com/…'
myUrl[1] = 'http://www.google. …'
myUrl[2] = 'http://www.whatsever….'

however you want to use it from there … is ?
haakoo
 
 
Posts: 189
Joined: Fri Apr 25, 2008 8:02 am
Location: Groningen/NL

Re: Question for Jordan(jQuery)

Post by haakoo »

Thanks,still need to tinker with it i guess :)

Hans
Post Reply