function togglePassFail(radioName) { var buttonGrp = document.getElementsByName(radioName); var radioValue = $(buttonGrp).filter(':checked').val(); var detailDiv = $(buttonGrp).eq(0).parent().next(); if ( radioValue == 'p' ){ detailDiv.hide(); }else{ detailDiv.show(); } }
On Sun, Dec 13, 2009 at 17:55, Ibatex <mjgris...@gmail.com> wrote: > Hi all, I'm new here and new to jquery in general. > > Question is how can I do the following in jquery, I'd like to have > access to jqueries effects and animations. > > function togglePassFail(radioName) { > var buttonGrp = document.getElementsByName(radioName); > var radioValue; > > // text input for related details are in a div thats the next > sibling > of the parent div of the radio buttons > var detailDiv = buttonGrp[0].parentNode.nextSibling; > > // get value of selected radio button > for (var i=0; i<buttonGrp.length; i++) { > if (buttonGrp[i].checked == true) { > radioValue = buttonGrp[i].value; > } > } > > // hide if pass is selected, show otherwise > detailDiv.style.display = (radioValue == 'p') ? 'none' : 'block'; > } > > Thanks ahead of time for any help. >