Answer the question
In order to leave comments, you need to log in
How to replace a piece of Html code with another one using Jquery?
<div id="camera" class="camera_wrap">
<div data-src="images/slide1.jpg">
</div>
<div data-src="images/slide2.jpg">
</div>
<div data-src="images/slide3.jpg">
</div>
Answer the question
In order to leave comments, you need to log in
$('[data-src=images/slide1.jpg]').attr('data-src',' images/slide1_small.jpg')
$(document).ready(function(){
if ($(document).width() < 450){
$('#camera div:first').remove;
$('<div data-src="images/slide1_small.jpg"></div>').insertBefore('#camera div:first');
}
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question