There is an array:
$arr = [ ['id'=>101, 'note'=>'Содержание_1'], ['id'=>108, 'note'=>'Содержание_2'], ['id'=>258, 'note'=>'Содержание_3'] ]; On the php page, radio buttons are generated whose value is equal to the 'id' element from the $ arr array.
Here is an example code:
<!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <script type="text/javascript" src="jquery-1.7.2.min.js"></script> <script> $(function(){ $('.id').click(function(){ $('.note').html($(this).val()); }); }); </script> </head> <body> <?php $arr = array( array('id'=>101, 'note'=>'Содержание_1'), array('id'=>108, 'note'=>'Содержание_2'), array('id'=>258, 'note'=>'Содержание_3') ); ?> <input class="id" name="id" type="radio" value="<?=$arr[0]['id']?>" />punkt 1 <input class="id" name="id" type="radio" value="<?=$arr[1]['id']?>" />punkt 2 <input class="id" name="id" type="radio" value="<?=$arr[2]['id']?>" />punkt 3 <div class="note"></div> </body> </html> Now when I select a radio button, the value of 'id' falls into the div class = "note".
Is it possible using javascript to extract the value of 'note' from the array $ arr, whose 'id' is equal to the value of the selected radio button and output in the div class = "note"