Created
January 3, 2015 16:35
-
-
Save taleeb35/4b72c614ba49ade51adf to your computer and use it in GitHub Desktop.
Increment Value
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
<html> | |
<input type="checkbox" class="check"> Smart Survical<br> | |
<input type="checkbox" class="check"> Smart Survical<br> | |
<a href="" name="WIS" id="udpate-text">Cart</a> | |
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> | |
<script> | |
$(document).ready(function(){ | |
var count = 0; | |
var value = $('a').text(); | |
//console.log(value); | |
$(".check").click(function(){ | |
var counts = $("[type='checkbox']:checked").length; | |
if(counts > 0){ | |
$('a').html(value + '(' + counts +')'); | |
} else { | |
$('a').html(value); | |
} | |
}); | |
}); | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment