<script type="text/javascript">
$(document).ready(function() { $("table[id*=MyGridViewID] input[type=text][id*=MyTextboxID]").keyup(function(event) { var elem = $("#"+ event.target.parentNode.parentNode.cells[7].children[0].id); if ($("table[id*=MyGridViewID] input[type=text][id*=MyTextBoxID]").val() != '') { elem.fadeIn(); } else { elem.fadeOut(); } }); }); </script>
try this Though surely there can be easier way to achieve the same like
<script type="text/javascript"> $(document).ready(function() { $("table[id*=MyGridViewID] input[type=text][id*=MyTextboxID]").keyup(function(event) { var targetElem = $(this); /* *var elem = $("#"+ event.target.parentNode.parentNode.cells[7].children[0].id); * same can be done like */ var elem = $($(targetElem.parents(1)).children("td").get(7)).children().get(0).id; if (targetElem.val() != '') { elem.fadeIn(); } else { elem.fadeOut(); } }); }); </script>
No comments:
Post a Comment