This question is related to another one I asked yesterday and its link is: Parse HTML in jquery through ajax into elements and replace each corresponding on page
Basically i want to call a php page with ajax and replace the elements in the response with the corresponding ones on the page. I got the following function in an answer:
$(data ).filter('.maindiv').each(function (index)
/* "this" is the current div in response*/
$('#'+this.id).replaceWith(this);
});
The above function woeks well when the div I want to replace has a regular id= but if use a custom attribute like gid= for example it won't work. How can i fix this??
Thanks
maindivso when i call the php i want to get what's in there and replace items that match on the html...if an element has<div id='1' class='maindiv'it should replace this and if an element has<div gid='1' class='maindiv'it should replace the one with the same class and attribute and so on