1:首先把值传给input
然后进行赋值:
modal.find('.modal-body input#ManagementID').val(management.managementID); modal.find('.modal-body input#ManagementName').val(management.managementName); modal.find('.modal-body input#ManagementRole').val(management.managementRole); modal.find('.modal-body input#ManagementRole1').val(management.managementRole); modal.find('.modal-body input#ManagementPhone').val(management.managementPhone); modal.find('.modal-body input#ManagementPass').val(management.managementPass); modal.find('.modal-body input#pageindex').val(pageindex); var role=$("#ManagementRole1").val() $("#ManagementRole option[value='"+role+"']").attr("selected","selected")
参考网站:https://blog.csdn.net/eluanshi12/article/details/78676861