FROM CACHE - en_header

Shopify Script Tag: Uncaught TypeError: $ is not a function

Solved
therahulissar
Tourist
6 0 1

Currently working on a shopify app which uses script tags to add a section on the thank you page (order status page). 

This is my test-script.js file: 

console.log('this is coming from script tag api!')

const header = $('div.section__content').parent('.section');
 
var myContent = function($) {

//content box contains some basic styling with divs and an image which I haven't included
const contentBox = $( ....).css(....)

header.prepend(contentbox)
}
 
I keep getting an Uncaught TypeError: $ is not a function when I check the chrome console. Am I supposed to add a jQuery script? Am confused on the next steps. 
 
 
Accepted Solution (1)

Accepted Solutions
Ajay_kumar_dev
Shopify Partner
175 16 13

This is an accepted solution.

Yes @therahulissar  , you need to add a jQuery script. Also, wrap up your jquery code within 

 
$( document ).ready(function() {
 // Wrap up your code here  
});

 

-If the problem is solved remember to click to Accept Solution
-if you want to modify or Customize your theme
Hire me
- Still, Facing issue, Reach out to me Email :- kmajay8888@gmail.com | Skype :- kmajay888

Figma to Shopify |PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO | Speed optimization

View solution in original post

Reply 1 (1)
Ajay_kumar_dev
Shopify Partner
175 16 13

This is an accepted solution.

Yes @therahulissar  , you need to add a jQuery script. Also, wrap up your jquery code within 

 
$( document ).ready(function() {
 // Wrap up your code here  
});

 

-If the problem is solved remember to click to Accept Solution
-if you want to modify or Customize your theme
Hire me
- Still, Facing issue, Reach out to me Email :- kmajay8888@gmail.com | Skype :- kmajay888

Figma to Shopify |PSD to Shopify | Shopify Design Changes | Shopify Custom Theme Development and Desing | Custom Modifications In to Shopify Theme | SEO | Speed optimization