[jQuery] Why would IE and FF give different code using clone?
Anyone have any idea why FF would respond properly to this code
and IE 7 creates different code for this clone?
Here's the original HTML:
<div id="image-div">
<input style="margin-top:20px; margin-bottom:20px; display:block;" class="image-next"
name="image-upload-1" type="file" size="65" value="">
</div>
Here's the jQuery:
$(document).ready(function() {
$('#add-image').click(function() {
$('.image-next:last').clone(true)
.attr('name', function() {
return this.name.replace(/(.+)(\d+$)/, function(s, p1, p2) {
return p1 + (parseInt(p2, 10) + 1);
})
})
.insertAfter('#image-div :last');
return false;
});
});
FF3 Creates this Code from the Clone (after one click on #add-image):
<div id="image-div">
<input style="margin-top: 20px; margin-bottom: 20px; display: block;" class="image-next"
name="image-upload-1" size="65" value="" type="file">
<input style="margin-top: 20px; margin-bottom: 20px; display: block;" class="image-next"
name="image-upload-2" size="65" value="" type="file">
</div>
IE7 Creates this Code from the Clone (after one click on #add-image):
(Note that the "name" isn't incremented from image-upload-1 to image-upload-2
and the part with jQuery1232483936140="19" etc is created in the IE7 cloned code)
<DIV id=image-div>
<INPUT class=image-next style="MARGIN-TOP: 20px; DISPLAY: block; MARGIN-BOTTOM: 20px" type=file
size=65 value="F:\photography\Stock Photos\iStockphoto\Real Estate\agent_folder.jpg"
name=image-upload-1 jQuery1232483936140="19">
<INPUT class=image-next style="MARGIN-TOP: 20px; DISPLAY: block; MARGIN-BOTTOM: 20px" type=file
size=65 value="F:\photography\Stock Photos\iStockphoto\Real Estate\agent-smiling-01.jpg"
name=image-upload-1 jQuery1232483936140="null">
</DIV>
Ideas or suggestions, anyone?
Thanks,
Rick