JSFiddle - React, Tailwind, and code Playground

by gion_13

HTML

<input type="text" id="pass" value="some password" />

JavaScript

$('#pass')
    .bind('focus',function() {
        var self = $(this);
        self.clone().attr('type', 'password').insertAfter(self).focus();
        self.detach();
        alert(self);
    })
    .bind('blur',function() {
         var self = $(this);
        self.clone().attr('type', 'text').insertAfter(self).focus();
        self.remove();
    });