I need to create elements in a way that is not too confusing and easy to maintain to make a change.
Currently I do it with this code with .append()
and .html()
:
$('.Selector').append(
'<div class="dropdown">'+
'<ul class="dropdown-menu" aria-labelledby="dropdownMenu1">'+
'<li><a href="#">Elemento Menu 1</a></li>'
'</ul>'+
'</div>'
)
But it's too confusing and difficult to maintain, or make tag changes.
Is there any other way to make it easier?
Investigating after a while I found this simple way, to create an element just put the label and separate the attributes with a comma:
Code example similar to what I wanted to achieve:
Referencia
This is a solution I did recently, yes! I know it's a bit tedious but with Brackets and emmet everything is made easier...