i tried change password input symbol other one. , did successfully. clear field. should use clear button on site, not delete key on keyboard. want fix able delete hidden input value clicking delete on keyboard. not clear button. code on codepen : http://codepen.io/abomostafacobra/pen/qkwgje
<h1>changing password security symbol</h1> <input type="text"/> <input type="hidden"/> <button class="post">post</button> <button class="clear">clear</button> <span>whin write wrong password clear clicking clear botton here not delete key in keyboard</span> <div></div>
jquery
$('input').on('keyup',function(){ var string = $('input[type=text]').val(); $('input[type=hidden]') .val( $('input[type=hidden]').val() + string.charat(string.length - 1) ); $('input[type=text]') .val( $('input[type=text]') .val().replace(/[^]/g,'@') ); }) $('.post').click(function(){ $('div').append('<b>' + $('input[type=hidden]').val() + '</b>') }) $('.clear').click(function(){ $('div').empty(); $('input[type=text]').val(''); $('input[type=hidden]').val(''); })
add code in jquery
$('html').keyup(function(e){ if(e.keycode == 46) { //alert('delete key pressed'); $('div').empty(); $('input[type=text]').val(''); $('input[type=hidden]').val(''); } });
you new code demo : http://codepen.io/sms247247/pen/orjjep
full code:
<!doctype html><html class=''> <head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-5710c30fb566082d9fcb6e7d97ee7e3f2a326128c9f334a4231b6fd752b29965.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-d5e4bf42585b8da8c18f7d963dbfc17cd66a79aa586c9448c4de8d6952ee9d97.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-25d1423d5d6fb975e7d61832d2c061422a94963ca446583b965dfc5569147311.js'></script><meta charset='utf-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="http://codepen.io/sms247247/pen/orjjep" /> <style class="cp-pen-styles"></style></head><body> <h1>changing password security symbol</h1> <input type="text"/> <input type="hidden"/> <button class="post">post</button> <button class="clear">clear</button> <span>whin write wrong password clear clicking clear botton here not delete key in keyboard</span> <div></div> <script src='//production-assets.codepen.io/assets/common/stopexecutionontimeout-58d22c749295bca52f487966e382a94a495ac103faca9206cbd160bdf8aedf2a.js'></script><script src='https://code.jquery.com/jquery-2.2.4.min.js'></script> <script>$('input').on('keyup', function () { var string = $('input[type=text]').val(); $('input[type=hidden]').val($('input[type=hidden]').val() + string.charat(string.length - 1)); $('input[type=text]').val($('input[type=text]').val().replace(/[^]/g, '@')); }); $('.post').click(function () { $('div').append('<b>' + $('input[type=hidden]').val() + '</b>'); }); $('.clear').click(function () { $('div').empty(); $('input[type=text]').val(''); $('input[type=hidden]').val(''); }); $('html').keyup(function (e) { if (e.keycode == 46) { $('div').empty(); $('input[type=text]').val(''); $('input[type=hidden]').val(''); } }); //# sourceurl=pen.js </script> </body></html>
Comments
Post a Comment