Solució web-dinamica-jquery
De wikiserver
Fitxer JS:
$(function(){
$('#contenido').append('<label>Crear etiqueta:</label>');
$('<input type="text" id="text1"/><br>').appendTo('#contenido');
$('#contenido').append('<label>Lugar:</label>');
$('<input type="text" id="text2"/><br>').appendTo('#contenido');
$('#contenido').append('<input type="button" id="web" value="crear"/>');
$('#web').on("click", function(){crear();});
});
function crear(){
var nuevaEtiqueta = $('#text1').val();
var lugar = $('#text2').val();
try{
$(lugar).append('<' + nuevaEtiqueta + '>LOREM IPSUM</' + nuevaEtiqueta + '>');
}catch(e){
console.log(e.toString());
$('<' + nuevaEtiqueta + '>LOREM IPSUM</' + nuevaEtiqueta + '>');
}
}
Fitxer HTML:
<!DOCTYPE html>
<html>
<head>
<title>Botons Celestials</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="js/jquery-2.1.0.js"></script>
<script type="text/javascript" src="js/Exhtml.js"></script>
</head>
<body>
<div id="contenido"></div>
</body>
</html>