Initializing
Liveweave
Web
expand_more
home
Home
data_object
CSS Explorer
arrow_outward
Palette
Color Explorer
arrow_outward
Polyline
Graphics Editor
arrow_outward
outbox_alt
Generative AI
arrow_outward
frame_source
Python Playground
New
arrow_outward
build
Tools
expand_more
restart_alt
Load "Hello Weaver!"
post_add
Generate Lorem ipsum...
code
Format HTML
code_blocks
Format CSS
data_object
Format JavaScript
library_add
Library
expand_more
A
Algolia JS
Animate CSS
Apex Charts JS
B
Bulma CSS
Bootstrap
C
Chart JS
Chartist
Create JS
D
D3
Dojo
F
Foundation
Fullpage JS
G
Granim JS
Google Charts
H
Halfmoon
J
jQuery
M
Materialize
Moment JS
Masonry JS
Milligram CSS
P
Pure CSS
Primer CSS
Popper JS
Pattern CSS
Picnic CSS
R
React JS
Raphael JS
Raisin CSS
S
Semantic UI
Skeleton CSS
Spectre CSS
Tachyons CSS
T
Tailwind
Three JS
U
UI Kit
Vis JS
W
Water CSS
download
Download
expand_more
developer_mode
Download as HTML
folder_zip
Download as .ZIP
cloud_upload
Save
account_circle
Login
settings
Settings
expand_more
14
px
Live mode
Night mode
Line number
Mini map
Word wrap
sync_alt
Reset Settings
smart_display
Run
<!DOCTYPE html> <html> <head> <meta charset='utf-8'> <meta name='viewport' content='initial-scale=1.0'> <meta http-equiv='X-UA-Compatible' content='IE=9' /> <link type='text/css' rel='stylesheet' href='http://necolas.github.io/normalize.css/3.0.1/normalize.css'/> <script type='text/javascript' src='http://code.jquery.com/jquery-latest.min.js'></script> </head> <body> <div align="center" /> <input type="text" class="newtag" placeholder="tagName here..." /> <input type="text" class="newclass" placeholder="className here..." /><br /> <input type="text" class="newname" placeholder="Name Attr here..." /><br /> <input type="text" class="newhref" placeholder="href here..." /><br /> <input type="button" class="convert" value="convert" /><br /> <a name="" class="btn-default selected" href="#">Hello world</a><br /> <textarea class="code hide"></textarea> </body> </html>
a { display: inline-block; width: auto; text-decoration: none; } .btn-default { background-color: #52bab3; } .btn-success { background-color: #5ece7f; } .btn-error { background-color: #e67478; } .btn-warning { background-color: #ff784f; } .btn-info { background-color: #9279c3; } [class^="btn-"] { padding: 15px 30px; border: 0; border-radius: 0.4em; color: #fff; text-transform: uppercase; font-size: 0.875em; font-weight: 400; transition: opacity 0.3s; display: block; } [class^="btn-"]:hover { opacity: .75; } [class^="btn-"]:active { opacity: initial; } .hide { display: none; }
$(document).ready(function() { $(".newtag").val( $(".selected").prop("tagName").toLowerCase() ); $(".newclass").val( $(".selected").attr("class").toLowerCase() ); $(".newname").val( $(".selected").attr("name").toLowerCase() ); $(".newhref").val( $(".selected").attr("href").toLowerCase() ); // Change selected element's tag function var changeTagName = function() { var $val = $(".newtag").val().trim().toLowerCase(); // If no value is set return to default if ($.inArray($val, [""]) > -1) { $(".selected").replaceWith( "<span class=\""+ $(".selected-element").val() +"\" \>"); $(".selected").html( $(".code").val() ); // Check if it's a textbox } else if ($.inArray($val, ["input[type=text]", "input", "textbox"]) > -1) { $(".selected").replaceWith( "<input type=\"text\" class=\""+ $(".selected-element").val() +"\" \>"); $(".selected").val( $(".code").val() ); // Check if it's an input button } else if ( $val === "input[type=button]" ) { $(".selected").replaceWith( "<input type=\"button\" class=\""+ $(".selected-element").val() +"\" \>"); $(".selected").val( $(".code").val() ); // Check if it's a textarea } else if ( $val === "textarea" ) { $(".selected").replaceWith( "<" + $val + " class=\""+ $(".selected-element").val() +"\" \>"); $(".selected").val( $(".code").val() ); // Use text as a placeholder to make a span tag } else if ( $val === "text" ) { $(".selected").replaceWith( "<span class=\""+ $(".selected-element").val() +"\" \>"); $(".selected").html( $(".code").val() ); } else if ( $val === "a" ) { $(".selected").replaceWith( "<a "+ ( $(".newclass").val() === "" ? "" : "class=\"" + $(".newclass").val() + "\"" ) + ( $(".newname").val() === "" ? "" : "name=\"" + $(".newname").val() + "\"" ) + ( $(".newhref").val() === "" ? "" : "href=\"" + $(".newhref").val() + "\"" ) + "\>"); $(".selected").html( $(".code").val() ); } else { // Make any others specified $(".selected").replaceWith( "<" + $val + " class=\""+ $(".selected-element").val() +"\" \>"); $(".selected").html( $(".code").val() ); } // Return tagName $(".newtag").val( $(".selected").prop("tagName").toLowerCase() ); }; // Change tagName from "Enter" Key $(document).keydown(function(e) { if ($(".newtag").is(":focus")) { if (e.which === 13) { changeTagName(); } } }); // Change selected element's tag $(".convert").on("click", function() { changeTagName(); }); // Show selected element's code // ex. <span class="selected">Hello world</span> $(".code").val( $(".selected").html() ); });