I have an DOM structure like below
<dt id="helloworld">Features</dt>
I want to change it like below using mootools
<div id="helloworld">Features</div>
How to do that? Basically the third tag changes from dt to div? I am new to mootols please. Can you give me an example please. There is only helloWorld in the page
I tried below
$$("#helloworld").each(function(el) {
new Element("div", {
html: el.get("html")
}).replaces(el);
});
It does replace the tag. But I also lose the id :(
You can pass the ID also as a property of the element constructor:
$$("#helloworld").each(function(el) {
new Element("div", {
html: el.get("html"),
id: el.get('id')
}).replaces(el);
});