Why my store not accepting javascript or jquery syntax?

Topic summary

A user is experiencing issues with JavaScript and jQuery code not executing properly in their Shopify store. Screenshots show code snippets that aren’t functioning as expected.

Key Problem:

  • JavaScript/jQuery syntax appears to be rejected or not working in the store environment
  • An alert() function works, but display-related code does not execute

Suggested Solution:

  • Another participant recommends console logging the element to check if it returns null
  • The issue may be related to code placement timing—the JavaScript might be running before the DOM is fully loaded
  • Suggestion to place the code after the document has loaded

Current Status:

  • The user confirmed the alert works on the collection page but the display functionality still fails
  • The root cause remains unresolved, with the discussion appearing to be ongoing
Summarized with AI on November 19. AI used: claude-sonnet-4-5-20250929.

Can someone help me why my store not accepting any js or jquery syntax?

store url

@irene-vintage

@made4Uo

1 Like

Hi @danica06

Have you tried console logging the element? If it turns out null, it might be the placement of your code. You actually have to place the code after the document loaded.

1 Like

Hi, I tried this one and put on my collection page and the alert works but the display don’t. I don’t know why.

danica06_2-1686234570790.png