Latest topics
» Forumactif Edge - Releases
by Ange Tuteur Tue 03 Sep 2019, 11:49
» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21
» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28
» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15
» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11
» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24
» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58
» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50
» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22
» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12
» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10
» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51
» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11
» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19
» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34
by Ange Tuteur Tue 03 Sep 2019, 11:49
» GIFActif - Giphy Button for the Editor
by Ange Tuteur Wed 08 May 2019, 17:21
» Forum Closure
by Ange Tuteur Mon 01 Jan 2018, 01:28
» Chit Chat Thread
by Valoish Sun 31 Dec 2017, 19:15
» Font/Text background color.
by Valoish Sun 31 Dec 2017, 19:11
» Forumactif Messenger - Instant Message Application for Forumotion
by Wolfuryo Sun 31 Dec 2017, 18:24
» [GAME] Count to One Million!
by brandon_g Fri 29 Dec 2017, 18:58
» Post Cards
by manikbiradar Wed 20 Dec 2017, 07:50
» [GAME] Countdown from 200,000
by Valoish Wed 13 Dec 2017, 23:22
» GeekPolice Tech Support Forums - GeekPolice.net
by Dr Jay Mon 11 Dec 2017, 19:12
» Asking about some plugin for Forumotion
by Dr Jay Mon 11 Dec 2017, 19:10
» [GAME] What are you thinking right now?
by Van-Helsing Sat 09 Dec 2017, 14:51
» Widget : Similar topics
by ranbac Wed 06 Dec 2017, 18:11
» Change the Background of the Forum and put an image and how to make prefixs?
by Clement Wed 06 Dec 2017, 15:19
» Hello from Western Australia
by SarkZKalie Wed 06 Dec 2017, 05:34
Recent Tutorials
Top posting users this month
Top Achievers
Who is online?
In total there are 59 users online :: 0 Registered, 0 Hidden and 59 Guests :: 2 Bots
None
Most users ever online was 515 on Tue 14 Sep 2021, 15:24
None
Most users ever online was 515 on Tue 14 Sep 2021, 15:24
add time in notication list
Page 1 of 1 • Share
- Ch@lo Valdez
- Gender :
Age : 49
Posts : 65
Points : 3896
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Forum Version :
hi, i try add in my notication list the time, i use this
how manage this array?
how add in "li" elements the right time?
my english is poor sorry
- Code:
$.get('/notification.forum').done(function (o) {
h = o.store;
for (var i = 0; i < h.length; i++) {
console.log(h[i].time)
}
})
how manage this array?
how add in "li" elements the right time?
my english is poor sorry
Last edited by Ch@lo Valdez on Tue 16 Aug 2016, 20:36; edited 1 time in total
Hi @Ch@lo Valdez,
You can try binding a click event to the document, and then when you click on the notification list you apply the necessary data. This is an example :
Where you see :
You can try binding a click event to the document, and then when you click on the notification list you apply the necessary data. This is an example :
- Code:
$(document).on('click', function(e) {
var that = e.target, list;
if (that.id == 'fa_notifications') {
list = document.getElementById('notif_list');
console.log(list.innerHTML);
}
});
Where you see :
- Code:
list = document.getElementById('notif_list');
console.log(list.innerHTML);
- Ch@lo Valdez
- Gender :
Age : 49
Posts : 65
Points : 3896
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Forum Version :
ok let me explain better:
when you call /notification.forum, return this array:
in html the notification list is this:
each li element has a id
my question is how compare in array, the array id with li id in a for in or for var, and insert text element in html to display the time of each notifcation
when you call /notification.forum, return this array:
in html the notification list is this:
each li element has a id
|
my question is how compare in array, the array id with li id in a for in or for var, and insert text element in html to display the time of each notifcation
In the data returned there should be an id for the notification in
. It can be accessed via
and it'll return the notification id. Then all you need to do is call getElementById or a jQuery query select. Here's an example :
I added "li" which stores the li tag for that notification to a variable for you to manipulate.
|
|
- Code:
$.get('/notification.forum').done(function (o) {
for (var h = o.store, i = 0, li; i < h.length; i++) {
li = document.getElementById('n' + h[i].text.id);
console.log(h[i].time);
console.log(li);
}
})
I added "li" which stores the li tag for that notification to a variable for you to manipulate.
- Ch@lo Valdez
- Gender :
Age : 49
Posts : 65
Points : 3896
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Forum Version :
ohh ok, i think i got it
- Ch@lo Valdez
- Gender :
Age : 49
Posts : 65
Points : 3896
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Forum Version :
- Ch@lo Valdez
- Gender :
Age : 49
Posts : 65
Points : 3896
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Forum Version :
ok convert it on my time zone
- Code:
$.get('/notification.forum').done(function (o) {
for (var h = o.store, i = 0, a, b, c, d, e; i < h.length; i++) {
a = h[i].time;
b = h[i].text.id;
c = document.getElementById('n' + b);
d = new Date(a);
e = d.toLocaleString();
c.insertAdjacentHTML('beforeend', '<b class="time_notif"><i class="fa fa-clock-o" aria-hidden="true"></i> '+ e +'</b>')
}
})
- Ch@lo Valdez
- Gender :
Age : 49
Posts : 65
Points : 3896
Reputation : 5
Location : Mexico
Language : eng spa
Browser : Forum Version :
uh oh, just now i read about of this service support is only for you responsive theme, i'm sorry
- GuestGuest
*** Topic solved, locked and archived ***
- Sponsored content
Similar topics
Create an account or log in to leave a reply
You need to be a member in order to leave a reply.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum