Add class to image in Squarespace using javascript or jquery -


i thought easy. added code injection header.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script> <script>$("img").addclass("example")</script> 

the scripts appear in page source, have no effect adding class images. i've tried specific div classes , ids, , other script variations, again no effect.

does squarespace somehow prevent assigning classes? image i'm trying target has no class assigned it. squarespace gives every element unique id, these can't selected because change every time page loaded.

you should this:

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>  <script>  $(function() {    $("img").addclass("example")  })  </script>
if put script in head.

the $(function() {}) wait till document loaded , call function inside.


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -