Last active
December 14, 2015 18:19
-
-
Save charlycoste/5128430 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://static.synap.fr/jquery.js"></script> | |
<script type="text/javascript"> | |
$(function(){ | |
var min=0,max=11; | |
function filter() { | |
console.log('min='+min+' max='+max); | |
$('option').each(function(){ | |
var val = parseInt($(this).val()); | |
if ( (min <val) && (val < max)) { | |
console.log( min +' < '+val+' < '+max); | |
$(this).show(); | |
} else { | |
$(this).hide(); | |
} | |
}); | |
$('select').addClass('updated'); | |
} | |
$('[name=min]').change(function(){min=$(this).val();filter()}); | |
$('[name=max]').change(function(){max=$(this).val();filter()}); | |
$('select').click(function(){$(this).removeClass('updated')}); | |
}); | |
</script> | |
<style type="text/css"> | |
.updated { | |
border: 2px solid red; | |
} | |
</style> | |
</head> | |
<body> | |
<input type="text" name="min" value="" /> < x < <input type="text" name="max" value="" /> | |
<select> | |
<option value="0">0</option> | |
<option value="10">10</option> | |
<option value="20">20</option> | |
<option value="30">30</option> | |
<option value="40">40</option> | |
<option value="50">50</option> | |
<option value="60">60</option> | |
<option value="70">70</option> | |
<option value="80">80</option> | |
<option value="90">90</option> | |
<option value="100">100</option> | |
<option value="110">110</option> | |
</select> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment