Skip to content

Instantly share code, notes, and snippets.

💭
ಠ_ಠ

Tim Parker timparker

💭
ಠ_ಠ
Block or report user

Report or block timparker

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View input-placeholder.js
/* JS fallback for HTML5 placeholder
* requires jQuery and Modernizr (to detect support)
* by Jon Raasch - @jonraasch - http://jonraasch.com/
* modified script from Nico Hagenburger: http://bit.ly/LgrkT0
*/
if(!Modernizr.input.placeholder){
$('[placeholder]').focus(function() {
var input = $(this);
if (input.val() == input.attr('placeholder')) {
@timparker
timparker / Restrict text field to only be numeric
Last active Dec 19, 2015
Only allow numeric values in a text input.
View Restrict text field to only be numeric
// Only allow numbers in a text field
$(".class").keydown(function(event) {
// Allow: backspace, delete, tab, escape, and enter
if ( event.keyCode == 46 || event.keyCode == 8 || event.keyCode == 9 || event.keyCode == 27 || event.keyCode == 13 ||
// Allow: Ctrl+A
(event.keyCode == 65 && event.ctrlKey === true) ||
// Allow: home, end, left, right
(event.keyCode >= 35 && event.keyCode <= 39)) {
// let it happen, don't do anything
@timparker
timparker / CSS3 Checkbox
Last active Dec 19, 2015
Replace default checkbox with a much nicer version.
View CSS3 Checkbox
<form>
<div class="check">
<input type="checkbox" value="None" id="newsletter" name="check" />
<label for="newsletter"></label>
</div>
</form>
form {
input[type=checkbox] {
visibility: hidden;
You can’t perform that action at this time.