Last edited December 11, 2013

How to add javascript files to shopify This post is outdated

Hi, I am very new to shopify, I want to use javascript to do some manipulations with the elements(say product image) of my website.For that I need to add javascript, i searched around and I think I got some idea how to do it, Please correct me if i am wrong:

- First I have to upload my jquery-1.4.3.min.js to my theme>assets.

2- Call the references in the HEAD section of my theme, Say

{{ 'jquery-1.4.3.min.js' | asset_url | script_tag }}

3- In the BODY section of my Theme include the code to do the manupulations(like change the image of a clicked product), e.g  say


 <div id="navigation">
<input type="hidden" name="demo2" />
<script type="text/javascript">
//some code

So any help would be highly appreciated>i would love to see some demo code or video tutorials for addressing this problem.Also if incase i want to distribute this feature as an widget then what steps do i have to follow.I know this is a very lame question to get things done quickly i would need all the help i can get.


Kylea Shopify Employee
December 18, 2013

Yes steps 1 and 2 are correct! For step 3 I would suggest placing any javascript/jQuery code either in a separate file, i.e scripts.js.liquid, otherwise just before the closing </body>.

Log in or sign up for an account to reply.

This thread has been closed! You will not be able to reply.