The forum of the forums
Would you like to react to this message? Create an account in a few clicks or log in to continue.

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

2 posters

Go down

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

Post by Ahmed.K 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.
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

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

Post by LGforum 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
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

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

Post by Ahmed.K 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.
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

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

Post by LGforum 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
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

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

Post by Ahmed.K 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>
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

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

Post by LGforum 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
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

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

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

Doesn't work.
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

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

Post by LGforum 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
LGforum
Hyperactive

Male Posts : 2265
Reputation : 264
Language : English
Location : UK

Back to top Go down

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

Post by Ahmed.K 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>'); ?
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

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

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

This one doesn't work too.
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

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

Post by Ahmed.K 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.
avatar
Ahmed.K
Forumember

Posts : 349
Reputation : 4
Language : English

Back to top Go down

Back to top


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