我正在为我的工作做一个项目。我有php通过数组创建多个单选按钮列表。每个类别的单选按钮列表有6个类别。我正在尝试将onclick javascript函数添加到其中一个单选按钮。最底部有一个文本框,我希望仅在单击某个单选按钮时显示。如果单选按钮是在html中创建的,而不是在php中通过数组创建,我知道如何创建它。
我有下面的代码
<?php
$form_fields = array(
"id" => array(
"bsc_id",
"fname",
"mname",
"lname",
"email",
"grad_id",
"major_id",
"grad_date",
"deg_id",
"age_id",
"ethn_id",
"res_id",
"assist_id",
"assist_other"
) ,
"name" => array(
"Banner ID",
"First Name",
"Middle Name",
"Last Name",
"E-mail Address",
"Status",
"Major",
"Graduation Date<br/>(mm-yyyy)",
"Degree",
"Age Group",
"Ethnicity",
"Residency",
"Greatest Assistance",
"If Assistance Other"
) ,
"type" => array(
"age_id" => "radio",
"grad_id" => "radio",
"major_id" => "select",
"deg_id" => "radio",
"ethn_id" => "radio",
"grad_date" => "date",
"res_id" => "checkbox",
"assist_id" => "radio"
) ,
"option" => array(
"age_id" => "sql:select * from age_code",
"grad_id" => "sql:select * from grad_code",
"major_id" => "sql:select * from major_code ORDER BY major_text",
"deg_id" => "sql:select * from deg_code",
"ethn_id" => "sql:select * from ethn_code",
"grad_date" => "fields:m-Y",
"res_id" => "sql:select * from res_code",
"assist_id" => "sql:select * from assist_code"
)
);
答案 0 :(得分:0)
在单选按钮已经渲染之后,您可以简单地使用类似jQuery
的内容来过滤选择的单选按钮,如果该列表不包含您要查找的“特定”按钮,则可以隐藏/删除/显示您的文本框。