Native: Element {#Element}

Extends the Element native object to include the convert method to convert an element to another type.

Demo

Element Method: convert {#Element:convert}

Copies an element with optional properties to a new element and destroys the old.

Arguments

  1. tag - (string) The tag for the new element
  2. properties - (array) The properties to copy.

Syntax

$('myElement').convert('textarea',['id','name','value']);

Returns