Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
82 lines (69 sloc) 2.553 kb
<html>
<head>
<title>Percentage</title>
</head>
<body>
<form>
<p>
<input type="text" name="input1" value="70" class="percent">
</p>
<p>
<input type="text" name="input2" value="30" class="percent">
</p>
<p>
<input type="text" name="input3" value="10" class="percent">
</p>
<p>
<input type="button" value="alert serialized form" id="alert-form">
</p>
<p>
<input type="button" value="remove form percentages" id="remove-form">
</p>
</form>
<p>
<span class="percent">80%</span>
</p>
<p>
<input type="button" value="alert serialized span" id="alert-span">
</p>
<p>
<input type="button" value="remove span percentage" id="remove-span">
</p>
<p class="percent">70%</p>
<p>
<input type="button" value="update above with 50%" id="update-p">
</p>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="./percentage.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('input.percent').percentage();
$('#alert-form').click(function() {
alert($(this).parents('form').serialize());
});
$('#remove-form').click(function() {
$('input.percent').percentage('destroy');
});
$('span.percent').percentage({
color: 'green'
});
$('#alert-span').click(function() {
alert($('span.percent').text());
});
$('#remove-span').click(function() {
$('span.percent').percentage('destroy');
});
$('#update-p').click(function() {
$('p.percent').percentage('set', 50);
});
$('p.percent').percentage({
color: 'pink',
clickable: 0,
width: 170,
height: 50,
border: '4px solid green'
});
});
</script>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.