Gaurav
Gaurav

Reputation: 902

Find and remove the elements with the specific attribute in the cloned object using jquery

I want to find and remove all the elements with specific attribute in the cloned object.

Following code works with the original object:

angular.element('.some-class [contenteditable]').removeAttr('contenteditable');

This code works fine, but don't know how to do it clone the object like:

temp = angular.element('.some-class').clone();

I want to remove all the elements with the attribute 'contenteditable'.

Upvotes: 1

Views: 40

Answers (1)

Satpal
Satpal

Reputation: 133403

You can use the .find() method, then perform the desired operation and use .end()

temp = angular.element('.some-class')
    .clone()
    .find('[contenteditable]')
    .removeAttr('contenteditable')
    .end(); 

Upvotes: 1

Related Questions