Skip to content

Instantly share code, notes, and snippets.

@taleeb35
Created January 3, 2015 16:35
Show Gist options
  • Save taleeb35/4b72c614ba49ade51adf to your computer and use it in GitHub Desktop.
Save taleeb35/4b72c614ba49ade51adf to your computer and use it in GitHub Desktop.
Increment Value
<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