Preview JavaScript function - Page 1

User 126415 Photo


Registered User
36 posts

Is there any way to preview a Java Script within the Editor without having to upload to my site?
User 187934 Photo


Senior Advisor
20,181 posts

Your script should work locally unless your referencing external libraries. If that's the case try using absolute links for the external scripts.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 126415 Photo


Registered User
36 posts

Thanks.

I am using: window.jQuery || document.write('<script src="js/jquery-1.9.1.min.js">.

If this is external referencing, then yes I am. I'm new to JavaScript.

If so, how do I create absolute links? And, if I make absolute links, will they be replacing the src="js/jquery on the actual site?
User 187934 Photo


Senior Advisor
20,181 posts

You don't need to write your script links with JS.
Try it like this.
<script src="js/jquery-1.9.1.min.js"></script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 126415 Photo


Registered User
36 posts

Thanks, Eric.

I do use the script tags.

Could you clarify: "Your script should work locally unless your referencing external libraries. If that's the case try using absolute links for the external scripts."

I don't know what this means or what to do with the information.

Thanks
User 187934 Photo


Senior Advisor
20,181 posts

If you were using Google hosted Jquery and you want it to work locally you will probably need to change the script to use absolute linking for testing.
Change this.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>

To this.
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 126415 Photo


Registered User
36 posts

Made the change, but still can't view locally.

Any other ideas?
User 187934 Photo


Senior Advisor
20,181 posts

One other thing are we talking browser preview or html editor built in live preview?
If it's browser then when you preview it hit f12 then refresh the page. Now see if there's any console errors.
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 126415 Photo


Registered User
36 posts

Browser preview. Live" is unavailable (greyed out).

This is what showed up in the:console" tab : ReferenceError: $ is not defined.

User 126415 Photo


Registered User
36 posts

The vconsole I sent you was in FF. This is what came up in Chrome (attached):
Attachments:

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.