jQuery function only inside a specific div ID
- by user412481
I have the following function that I only want to run inside a specific div with the id of imgWrapper.
I have tried a few things with parent but I cannot seem to figure this out.
<script type="text/javascript" language="javascript">
$(document).ready(
function () {
$("img").each(function () {
var src = $(this).attr("src");
if (src.substring(0, 1) == "/")
$(this).attr("src", "http://serverName.com/" + src.substring(1))
});
}
);
</script>