I am trying to wrap a specific <img>
tag with a <span>
element and assign a class to the <span>
.
Below is the relevant code snippet:
<img id="wrapped-image" alt="" src="">
Despite my efforts, the following code does not seem to work as intended:
<script>
$( '#wrapped-image' ).wrap( '<span class="jquery-wrapped"></span>' );
</script>
Additional Details
The image in question is the smiley face icon commonly used by Jetpack for tracking purposes. It can be found on this website: . The accompanying JavaScript mentioned above is also included on the same webpage, immediately following the Jetpack smiley (you can check the page source).