Getting data from a range of values
I'm trying to get a range of numbers depending on what the user inputs.
I have customer.js which has the customer name and shoe size and what I would like is to get a range of shoe sizes depending
on what the user puts in.
For example. A user puts in the first textbox 5 and in the second textbox 9 I want the customers that is between 5 and 9,
but also including 5 and 9 to be displayed.
I've only gotten as far as this.
my html
- <form id="shoe_size">
- <label for="size">Enter sizes</label>
- <input type="text" name="size1" class="size1">
- <input type="text" name="size2" class="size2">
- <input type="submit" value="Search" class="submit">
- </form>
my jquery
- $('#shoe_size').on('submit', function(){
- var size1 = $('.size1').val();
- var size2 = $('.size2').val();
- $('.table tr').each(function(){
- var size = 'false';
- $(this).each(function(){
- if(size1 <= size2){
- found = 'true';
- }
- })
- if(size == 'true'){
- $(this).show();
- }else{
- $(this).hide();
- }
- });
- });