Created
December 27, 2012 03:12
-
-
Save teetteet/4385149 to your computer and use it in GitHub Desktop.
A CodePen by goker cebeci. ESCAPE IT! - char to escapechar with JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h1>escape it!</h1> | |
<input name="char" value="ğ" /> | |
<code id="escaped">%u011F</code> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('input[name=char]').on('keyup', function(){ | |
var c = $(this).val(); | |
if(c.length > 1) | |
c = c.charAt(1); | |
$(this).val(c); | |
$('#escaped').html(escape(c)); | |
}); | |
$('input[name=char]').focus(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@import url(http://fonts.googleapis.com/css?family=Ubuntu); | |
body, html { | |
font-family: 'Ubuntu', sans-serif; | |
color: #000; | |
background: WhiteSmoke; | |
text-align: center; | |
} | |
h1 { | |
font-size: 48px; | |
font-weight: bold; | |
margin: 40px 0 10px; | |
position: relative; | |
text-align: center; | |
text-transform: uppercase; | |
text-shadow: 0 0 2px #000; | |
z-index: 0; | |
} | |
input, code { | |
display: block; | |
margin: 5px auto; | |
padding: 5px 10px; | |
width: 210px; | |
color: #ddd; | |
font-size: 40px; | |
font-family: 'Ubuntu', sans-serif; | |
text-align: center; | |
text-shadow: 0 0 2px #fff; | |
border: 1px solid #666; | |
background: #000; | |
border-radius: 3px; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment