JSFiddle - React, Tailwind, and code Playground

by eddiemonge

JavaScript

var t = 'sometext';

var input = $('<input>', {
    name: "entity",
    class: "topic new_topic_input",
    type: "text",
    value: t,
    placeHolder: 'wat wat'
}).appendTo('body');

input.css({
    border: '2px solid green',
    'border-radius': 5,
    '-webkit-border-radius': 5,
    background: 'lightgreen',
    color: 'darkgreen',
    padding: 4,
    margin: '5px 10px',
    height: 20
}).focus(function(){
    if ( this.type === "text" ) {
        this.value = "";
        this.type = 'password';
    }
}).blur(function() {
    if ( this.value === "" ) {
        this.type = 'text';
    }
});