By default, jQuery does not allow modify the type
of a element, if you do so, a error will occur: Error: type property can't be changed
1
|
|
But if when the target element is detached
from DOM tree, then the type can be changed, so we can use jQuery to change the type in this way(we need create a new element to mark the position of the target element):
1 2 3 |
|
Do you think you’ve get the final answer? No ! Dom element supports modify type
directly, so the simplest way should be:
1
|
|