0
votes

I have a select drop down whose values come from the database as shown below:

<aui:select id="empName" name="empName">
 <%
    List<Employee> EmpList =     EmployeeLocalServiceUtil.getEmployees(-1,-1);
for(Employee emp : EmpList ) {
  %>
  <aui:option value='<%=emp.getEmpFname()%>'><%=emp.getEmpFname()%><%=emp.getEmpLname()%></aui:option>
  <% } %>
</aui:select>

I assign this value to a label using the code below:

   $(document).ready(function(){
     $('select[id*=empName]').change(function(){
        var value = $(this).val();      
        $('#myUniqueLabelId').text(value);
     });
   });

where myUniqueLabelId is the id of the label.

I have radio buttons say-

 <input type = "radio" name = "radioex" id = "radio1 value = "ex1"/>
 <input type = "radio name = "radioex" id = "radio2"/>

to the radio button with id = radio2 I want to assign the value selected from the drop box so that I can use it in my action class. How should I do this using jQuery?

1

1 Answers

1
votes

You can use this code to assign the value of #radio2

$('select[id*=empName]').change(function(){
    var value = $(this).val();      
    $("#radio2").val(value);
});