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.

Adding a div with javascript: what's wrong

View previous topic View next topic Go down

Solved Adding a div with javascript: what's wrong

Post by Niko on March 27th 2014, 3:13 pm

Hello mates,

can you help me telling me what's wrong with this code?

if I use it in the console of google chrome, it works
if I add it in the javascript panel (in ACP) it doesn't workCrying or Very sad

Code:
var where = 'body .pun #content #main #main-content .main .main-content';
if($(where).has('.descimg')) {
$(where).addClass('addseparator');
}; $('.main-content.addseparator').append('<div id="separatores"></div>');

Thank you guysMr. Green


Last edited by Niko! on March 27th 2014, 3:43 pm; edited 1 time in total

Niko
Hyperactive

Male Posts : 2298
Reputation : 97
Language : English, French, Italian, Spanish, Latin

https://www.translationscloud.com/?utm_source=forumotion&utm

Back to top Go down

Solved Re: Adding a div with javascript: what's wrong

Post by Pizza Boi on March 27th 2014, 3:30 pm

Hi Very Happy

I'm definitely not really awesome in Javascript but I think it's with the added class and the spelling .-.

Code:
var where = 'body .pun #content #main #main-content .main .main-content';
if($(where).has('.descimg')) {
$(where).addClass('addseparator');
}; $('.addseparator').append('<div id="separator"></div>');

Since you're using a declared ID, you should have a style for div id="separator" for anything to appear because it does not contain anything.

Say, put something in the JS like: <div id="separator">This isn\t google</div> or any of the sort.

Regards,
Pizza Boi

Pizza Boi
Hyperactive

Male Posts : 2016
Reputation : 160
Language : French
Location : Pizza Hut!

http://redlustempire.forumtl.com/

Back to top Go down

Solved Re: Adding a div with javascript: what's wrong

Post by Niko on March 27th 2014, 3:42 pm

I know... i haven't shared the css code

actually the problem was that the div wasn't added at all


anyway, I solved with templates (in another way)
thank you thumleft

Niko
Hyperactive

Male Posts : 2298
Reputation : 97
Language : English, French, Italian, Spanish, Latin

https://www.translationscloud.com/?utm_source=forumotion&utm

Back to top Go down

Solved Re: Adding a div with javascript: what's wrong

Post by Ange Tuteur on March 27th 2014, 4:31 pm

Since no solution was given => garbaged

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

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