Am i able to execute jQuery code in Target? | Community
Skip to main content
New Participant
August 28, 2019
Solved

Am i able to execute jQuery code in Target?

  • August 28, 2019
  • 5 replies
  • 7387 views

is it possible to execute jQuery code from the custom code box within Target for specific experiences? The website has the jQuery library loaded already.

I am trying to do some simple things like $('body').hide(); commands, but no such luck. The end result is to use ajax

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Shruti_Premkumar

stevemalko​ Yes its possible to execute jQuery using the custom code section. The same has been documented at Modifications overview and there are samples provided as well in that document .

Hope this helps answer your question.

5 replies

Employee
August 29, 2019

Using custom code, you can almost do whatever we do on a HTML page so you can jquery or JavaScript code enclosed within a <script> tag.

Note: if you are using some functions of jquery then make sure the relevant jquery file is present on the page.

Are you loading jquery after target on the web page ?

johnanish-1
New Participant
August 29, 2019

Thats pretty much what I would have done as well. Check if jQuery was "ready".

Employee
August 28, 2019

Awesome. Thanks for that quick confirmation.

New Participant
August 28, 2019

Thanks. the mistake I was making was not wrapping it in a document.ready function. once I did that, everything worked, including ajax calls

Shruti_PremkumarAccepted solution
Employee
August 28, 2019

stevemalko​ Yes its possible to execute jQuery using the custom code section. The same has been documented at Modifications overview and there are samples provided as well in that document .

Hope this helps answer your question.