Tuesday, 15 April 2014

javascript - Radio button and check box checked, depending on value on the top of the page -



javascript - Radio button and check box checked, depending on value on the top of the page -

i have page depending on val on top of page, select check boxes shown or hidden.

if value val check boxes shown , after selecting check box, values populated in text area. far works.

now if value mar check boxes hidden. values not populating in text area.

help much appreciated. fiddle

$('table').find("input[type=radio]:checked:enabled").each(function () { if($('table').find("input[type=checkbox][name='" + $(this).attr('name') + "']").is(':checked')) { // see if have text box, if utilize text var $text = $(this).parent().find('textarea.m-notes:visible'); var missingreason = $(this).parent().find('.reason').val(); // find closest ancestor id var selectedid = $(this).closest('[id]').attr('id'); var value = selectedid + "~" + $(this).val(); if ($text.length) { value += "~" + missingreason +"~" + $text.val(); } clicked.push(value); } }); //checked // display selected ids $("#inputhere").val(clicked.join('|')); }

javascript jquery

No comments:

Post a Comment