I have to swap the div.
Swapping is working fine( I am using Jquery Swap Plugin for that).
After swap I want to swap the ID of DIVs too.
Please find JQuery Code. Kindly help me out how should I swap the DIV IDs.
$(".arrowIMG").click(function() {
var arr = this.id.split("_");
if(arr[0] == 'down'){
var div1 = $('#'+'div_' +arr[1]);
var next = (parseInt(arr[1]) + 1);
alert(next)
var div2 = 'div_' + next;
div1.swap({
target: div2,
opacity: "0.5",
speed: 1000,
callback: function() {
//Now Here i want to swap the id of div (div1 and dev2)
}
});
}else if(arr[0] == 'up') {
alert('up');
}
});
Kindly help me out the way to swap the DIV IDs.
I’m not sure exactly what the desired behavior of your function is – but the following should work to change an ID: