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.

Javascript not working

2 posters

Go down

Solved Javascript not working

Post by Mati November 21st 2014, 8:44 am

I'm using this Javascript to add a text before the Forum name:


Code:
$(document).ready(function(){
$('img[src="http://i59.servimg.com/u/f59/14/73/12/96/status10.png"]').replaceWith('<div id="new-mes">New</div>')
});

This is the Forum - New icon, and this is the example!
Javascript not working Status10 News & Announcements New
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Javascript not working

Post by Ange Tuteur November 21st 2014, 8:50 am

Hello Mati,

Try this :
Code:
$(function() {
  $('.forabg dl[style*="http://i59.servimg.com/u/f59/14/73/12/96/status10.png"]').append('<div id="new-mes">New</div>');
});

The images are set as backgrounds in phpbb3, so you have to check the style attribute.
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Javascript not working

Post by Mati November 21st 2014, 9:54 am

Oki, but how to make it so can show before the forumtitle and not before lastpost see -> http://fmfocus.forumotion.net/forum
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Javascript not working

Post by Ange Tuteur November 21st 2014, 10:06 am

See if this works :
Code:
$(function() {
  $('.forabg dl[style*="http://i59.servimg.com/u/f59/14/73/12/96/status10.png"]').find('a.forumtitle').append('<div id="new-mes">New</div>');
});
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Solved Re: Javascript not working

Post by Mati November 21st 2014, 10:19 am

Perfect thank you so much for your help. Smile
Mati
Mati
Active Poster

Posts : 1933
Reputation : 333
Language : HTML, CSS & JavaScript
Location : Forum Services

https://fm-focus.forumotion.com/

Back to top Go down

Solved Re: Javascript not working

Post by Ange Tuteur November 21st 2014, 10:30 am

You're welcome Javascript not working 1852325475

Topic archived

Have a great day. Smile
Ange Tuteur
Ange Tuteur
Forumaster

Male Posts : 13207
Reputation : 3000
Language : English & 日本語
Location : Pennsylvania

https://fmdesign.forumotion.com

Back to top Go down

Back to top


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