Sandeep Shawn Tripathy Sandeep Shawn Tripathy - 28 days ago 5
jQuery Question

Add query string to Image Source(img src) if it has a particular class or ID

I want this in either PHP or JS. Its like, if img has particular class them a query string will be appended to its source url. Lets assume, the particular class is 'hello' & query string is '?source=fb'
So, if img has class 'hello' -

<img class="hello" src="">

The PHP should check & append it to the img src.

Any function that can do this?


<script src=""></script>
<img class="hello" src="">

Use like this