1.

Explain .empty() Vs .remove() Vs .detach()?

Answer»
  • .empty() METHOD is used to remove all the child elements from MATCHED elements.
  • .remove() method is used to remove all the matched element. This method will remove all the jQuery data associated with the matched element.
  • .detach() method is same as .remove() method except that the .detach() method doesn’t remove jQuery data associated with the matched elements.
  • .remove() is FASTER than .empty() or .detach() method.

Syntax:

$(SELECTOR).empty(); $(selector).remove(); $(selector).detach();

Syntax:



Discussion

No Comment Found