What i want is the select div to be displayed only if the value of the input tag next to it is zero. How do i do this?
Here is the jsfiddle http://jsfiddle.net/mdanz/xdFkJ/
<style type="text/css">
.select {
overflow:hidden;
display:block;
background-color:red;
width:100px;
height:100px;
}
</style>
<script type="text/javascript">
$(function() {
var value = $('.row').val();
if(value!=0) {
$('.select').hide();
}
});
</script>
<div class='select'></div><input type='text' class='row' value='0' />
<div class='select'></div><input type='text' class='row' value='1' />
<div class='select'></div><input type='text' class='row' value='1' />
<div class='select'></div><input type='text' class='row' value='0' />
Here is the fiddle http://jsfiddle.net/jfhartsock/xdFkJ/3/. Note this will also hide the divs when you modify the inputs.