Last active
August 24, 2017 12:32
-
-
Save LiamBailey/3602b6c5a8e2b134c5b39765065d6fa4 to your computer and use it in GitHub Desktop.
This file contains 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
jQuery(function($) { | |
var beforeButton = $("<i class='incr-button fa fa-minus-circle fa-2x' />"); | |
var beforeButtonClick = function() { | |
var input = $(this).next(); | |
input.val(new Number(input.val()) - 1); | |
} | |
var afterButton = $("<i class='incr-button fa fa-plus-circle fa-2x' />"); | |
var afterButtonClick = function() { | |
var input = $(this).prev(); | |
input.val(new Number(input.val()) + 1); | |
} | |
$("input[type='number']").before(beforeButton); | |
$("input[type='number']").after(afterButton); | |
}) |
This file contains 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
/* Styles for buttons */ | |
.fa-plus-circle { | |
color: green | |
} | |
.fa-minus-circle { | |
color: green | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment