BullGuard Antivirus Sale - 60% Off with openElement !
Forum Home Forum Home >

openElement

> openElement General Discussion
  New Posts New Posts RSS Feed - jquery/js
  FAQ FAQ  Forum Search   Register Register  Login Login

jquery/js

 Post Reply Post Reply
Author
Message
Gorksmash View Drop Down
Senior Member
Senior Member


Joined: Jan 09 2014
Location: Lansing, MI
Status: Offline
Points: 133
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gorksmash Quote  Post ReplyReply Direct Link To This Post Topic: jquery/js
    Posted: Mar 06 2014 at 4:25pm
I am having trouble getting my javascript to run when I preview my site in OElement
I have it working here on a jsfiddle : http://jsfiddle.net/gorksmash/3RwpH/
I have placed a visual code block with the html content from the jsfiddle as well as a source code block with the javascript in it. I also added a source html code block  containing the javascript reference in it to the start of the document.
If I add
window.onload = function() {
alert( "welcome" );
}
to my javascript I get the message popping up saying welcome.
How come I can't get my other functions to run when they are supposed to?
Back to Top
Gorksmash View Drop Down
Senior Member
Senior Member


Joined: Jan 09 2014
Location: Lansing, MI
Status: Offline
Points: 133
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gorksmash Quote  Post ReplyReply Direct Link To This Post Posted: Mar 06 2014 at 4:38pm
Upon further research (I always seem to find answers to stuff right after I ask for help) I found that if I wrap all of my functions in a document ready function then everything runs. I needed a listener, I just didn't understand the difference between the jsfiddle part and the OElement.
$( document ).ready(function() 
{
});

Back to Top
Dmit OE View Drop Down
Admin Group
Admin Group


Joined: May 31 2012
Status: Offline
Points: 5283
Post Options Post Options   Thanks (0) Thanks(0)   Quote Dmit OE Quote  Post ReplyReply Direct Link To This Post Posted: Mar 06 2014 at 4:42pm
  Smile

Edited by Dmit OE - Mar 06 2014 at 4:42pm
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.063 seconds.