The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

eq(x,x) and eq(x) with the profile page...

View previous topic View next topic Go down

eq(x,x) and eq(x) with the profile page...

Post by Ahmed.K on October 5th 2012, 4:38 am

When using two (dl) from the same profile page, what is the best way to do this...

using it twice? eq(3) and eq(6)

Code:
$(function() {
$('#profilepage1').load('/u={*USERNAME} #profile-advanced-details dl:eq(3)');
});
<span id="profilepage1"></span>

and
Code:
$(function() {
$('#profilepage2').load('/u={*USERNAME} #profile-advanced-details dl:eq(6)');
});
<span id="profilepage2"></span>

Or there is another, better way?


Note: should be each dl (eq(x)) with different id or class.

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by LGforum on October 5th 2012, 10:40 pm

You'd be better off, loading the parent element like so:
Code:
$('#profilepage2').load('/profile.forum?mode=viewprofile&u={*USERNAME} #profile-advanced-details', function() {
  // sort out #profilepage2 to only contain the two elements you want.
});

Then removing everything except the to DL elements you want.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by Ahmed.K on October 6th 2012, 4:41 am

what do you mean?

I want something like this (this is wrong code, but just to catch my point):
Code:
    $('#profilepage').load('/profile.forum?mode=viewprofile&u={*USERNAME} #profile-advanced-details', function() {
$('#profilepage1') document.getElementById('#profile-advanced-details dl')[3];
$('#profilepage2') document.getElementById('#profile-advanced-details dl')[6];
    });
just one load but with two dl, and each dl with different id or class.

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by LGforum on October 7th 2012, 3:39 am

Yes that's what I'm saying.
Doing this .load() :
Code:
$('#profilepage2').load('/profile.forum?mode=viewprofile&u={*USERNAME} #profile-advanced-details', function() {
  // sort out #profilepage2 to only contain the two elements you want.
});

You are loading the '#profile-advanced-details' element, which contains your two DL elements. All you need to do is then move them out of that and put them where you want them.... one load, two DL's.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by Ahmed.K on October 7th 2012, 7:21 am

@LGforum wrote:All you need to do is then move them out of that
Well, how? giving id for these parts:
#profile-advanced-details dl:eq(3)
#profile-advanced-details dl:eq(6)

is this correct?
Code:
$('#profilepage').load('/profile.forum?mode=viewprofile&u={*USERNAME} #profile-advanced-details', function() {
$('#profilepage1') #profile-advanced-details dl:eq(3)
$('#profilepage2') #profile-advanced-details dl:eq(6)
});
<div id="profilepage1"></div>
<div id="profilepage2"></div>

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by LGforum on October 7th 2012, 6:04 pm

Code:
$('#profilepage').load('/profile.forum?mode=viewprofile&u={*USERNAME} #profile-advanced-details', function() {
    $('#profilepage1').append( $('#profile-advanced-details dl:eq(3)')[0] );
    $('#profilepage2').append( $('#profile-advanced-details dl:eq(6)')[0] );
})

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by Ahmed.K on October 7th 2012, 10:25 pm

Doesn't work.

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by LGforum on October 8th 2012, 5:03 pm

Well I don't know what your doing... I've just showed you what you wanted... you wanted to get the 2 DL elements with one load. Thats the way to do it, get its parentNode, and then get the two DL elements and put them where you want them to go.

LGforum
Hyperactive

Male Posts : 2254
Reputation : 254
Language : English
Location : UK

http://www.avacweb.com/

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by Ahmed.K on October 8th 2012, 5:31 pm

See, Just it works with this one

Code:
$(function() {
    $('#profilepage1').append('<div id="profilepage"></div>');
    $('#profilepage').load('/profile.forum?mode=viewprofile&u={*USERNAME} #profile-advanced-details dl');
    });
but not with this .append( $('#profile-advanced-details dl:eq(3)')[0] ); i don't know why.

Now, how we add eq(3) to .append('<div id="profilepage"></div>'); ?

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by Ahmed.K on October 9th 2012, 10:50 am

This one doesn't work too.

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Re: eq(x,x) and eq(x) with the profile page...

Post by Ahmed.K on October 9th 2012, 1:01 pm

The HTML code in widget and javascript in Javascript codes management
You have a private message with an admin account on the test forum.

Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum