Who is online?
In total there is 1 user online :: 0 Registered, 0 Hidden and 1 Guest None
Most users ever online was 246 on Tue 31 Jan - 2:47
Statistics
We have 150 registered usersThe newest registered user is Luxic
Our users have posted a total of 2050 messages in 200 subjects
Latest topics
» A small shareby Flora Today at 21:03
» Edit the 404 page on Forumotion
by LGforum Today at 15:29
» How to Change The Homepage?
by LGforum Today at 15:28
» Counter for my notices box
by Niko Today at 15:03
» 21. Show Recent Topics Preview In Accordion
by ReBoRN Yesterday at 19:08
17. Variable in HTML Pages and Templates
Page 2 of 2 • Share •
Page 2 of 2 •
1, 2
Re: 17. Variable in HTML Pages and Templates
@ http://jsfiddle.net/defencedog/cu5VJ/
Provided that we can use this also:
$('.' + x[i].id).text(x[i].innerHTML);
why can't we use
$('.' + x[i].id).innerHTML(x[i].innerHTML);
Provided that we can use this also:
$('.' + x[i].id).text(x[i].innerHTML);
why can't we use
$('.' + x[i].id).innerHTML(x[i].innerHTML);
ion-cube
Status: Testing
Posts: 121
Join date: 2011-10-19
Age: 23
Location: Pakistan
Re: 17. Variable in HTML Pages and Templates
how about a user avatar??
what id should i use?
what id should i use?

pidot101
Status: . . .
Posts: 58
Join date: 2011-12-09
Age: 16
Re: 17. Variable in HTML Pages and Templates
ion-cube wrote:@ http://jsfiddle.net/defencedog/cu5VJ/
Provided that we can use this also:
$('.' + x[i].id).text(x[i].innerHTML);
why can't we use
$('.' + x[i].id).innerHTML(x[i].innerHTML);
Because 'innerHTML' is native javascript method to be used on elements. In that second line of yours it would be using it on a jQuery function not an element.

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Re: 17. Variable in HTML Pages and Templates
A sort of follow up mini tutorial here: http://www.avacweb.com/t129-user-avatar-variable

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Re: 17. Variable in HTML Pages and Templates
very nice code .
i trying code sooon
thanks.
i trying code sooon
thanks.
midoweb96- Posts: 3
Join date: 2012-02-06
Re: 17. Variable in HTML Pages and Templates
I need another clarification, in this line
$('.'+x[i].id).html(x[i].innerHTML);
what is .id ?
$('.'+x[i].id).html(x[i].innerHTML);
what is .id ?
ion-cube
Status: Testing
Posts: 121
Join date: 2011-10-19
Age: 23
Location: Pakistan
Re: 17. Variable in HTML Pages and Templates
Thats the clever bit of this script.
It loops through the elements holding the variables, and it gets that elements ID.
So 'x[i].id' is the ID of the element, so for instance 'USERNAME'
the '.'+x[i].id would = '.USERNAME' which when put into a jQuery selector, wil search the element with className of USERNAME, and inserts the same HTML as the variable
It loops through the elements holding the variables, and it gets that elements ID.
So 'x[i].id' is the ID of the element, so for instance 'USERNAME'
the '.'+x[i].id would = '.USERNAME' which when put into a jQuery selector, wil search the element with className of USERNAME, and inserts the same HTML as the variable

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Re: 17. Variable in HTML Pages and Templates
thank you sir...BUT I knew why it was there the question was WHAT it was I can't find any documentation on .id ??
ion-cube
Status: Testing
Posts: 121
Join date: 2011-10-19
Age: 23
Location: Pakistan
Re: 17. Variable in HTML Pages and Templates
Oh okay. Yup most attributess can be accessed just like that.
- Code:
elem.id
elem.href
elem.target
elem.className
etc...

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Re: 17. Variable in HTML Pages and Templates
is it jquery or js syntax
ion-cube
Status: Testing
Posts: 121
Join date: 2011-10-19
Age: 23
Location: Pakistan
Re: 17. Variable in HTML Pages and Templates
is this working with all the variables from the templates?
razvan- Posts: 17
Join date: 2011-11-11
Re: 17. Variable in HTML Pages and Templates
Its with all the ones FM provide for you to use.
Not the ones IN templates like {GENERATED_NAV_BAR} and stuff.
Not the ones IN templates like {GENERATED_NAV_BAR} and stuff.

LGforum- Forum Version: Phpbb3
Posts: 729
Join date: 2011-10-05
Location: UK

Page 2 of 2 •
1, 2
Page 2 of 2
Permissions in this forum:
You cannot reply to topics in this forum