scientiffic
scientiffic

Reputation: 9415

jQuery Clone - check equality

On my website, I clone a div's contents when the page loads, and then I check whether or not the contents have changed.

originalStepOrder = $('#org').clone();
console.log(originalStepOrder[0] == $('#org')[0]);

I expected that the last line of code would return true when I haven't made any changes to the div's contents, but it returns false.

I also tried

console.log(originalStepOrder.is($('#org'));

which also returns false.

How can I check whether or not two divs have the same content?

Upvotes: 0

Views: 111

Answers (1)

scientiffic
scientiffic

Reputation: 9415

Whoops, posted too soon–I was able to figure out the answer. This is what ended up working for me:

$('#org').html()==originalStepOrder.html()

Upvotes: 2

Related Questions