title: Getting relative image src with jQuery
body: <p>I've got image tags that look like this:</p>
  
  <pre><code>&lt;img src="/path/to/my/image.jpg" /&gt;
  </code></pre>
  
  <p>But when I access the src bit using jQuery, jQuery gives me back:</p>
  
  <pre><code>http://example.com/path/to/my/image.jpg
  </code></pre>
  
  <p>This is causing problems in some comparisons I'm doing. I don't want to change my image paths to use absolute URLs.</p>
  
  <p>Any ideas as to how I can either get the absolute URL from the image path (this might not be as simple as concatenating the domain - since the URLs may occasionally be absolute), or get the path I provided in the HTML? Either way I need them to match up.</p>
  
  <h3>Edit per comment from activa</h3>
  
  <p>There's not really a lot of jQuery code to post, I'm using the <a href="http://malsup.com/jquery/cycle/" rel="noreferrer">cycle</a> plugin, and in the <code>onbefore</code> function, I'm just calling <code>next.src</code>. My jQuery and JavaScript foo isn't sufficient to really understand what the cycle plugin is doing to generate <code>next</code> - I think it's the DOM element for the next image being cycled in, if you're familiar with what cycle does.</p>
  
  <p>My image tag is actually this:</p>
  
  <pre><code>&lt;img src="/site_media/photologue/photos/cache/6927d406810ee9750a754606dcb61d28.jpg" alt="" class="landscape slideshow-image-1" /&gt;
  </code></pre>
  
  <p>and in my <code>onbefore</code> function this code:</p>
  
  <pre><code>alert(next.src);
  </code></pre>
  
  <p>results in an alert with:</p>
  
  <pre><code>http://127.0.0.1:8000/site_media/photologue/photos/cache/6927d406810ee9750a754606dcb61d28.jpg
  </code></pre>