var ProxmoxCloudVps_td1; var ProxmoxCloudVps_td2; var ProxmoxCloudVps_accesshash; var ProxmoxCloudVps_selectAdded = false; function ProxmoxCloudVps_addSelect(){ var accessTd = $( "#inputServerType").closest("tbody").find(" tr:eq(3)").find(" td:eq(0)"); ProxmoxCloudVps_td1 = accessTd.html(); accessTd.html("Authentication"); var accessInput = $( "#inputServerType").closest("tbody").find(" tr:eq(3)").find(" td:eq(1)"); ProxmoxCloudVps_td2 = accessInput.html(); accessInput.html(""); ProxmoxCloudVps_accesshash ? $("select[name='accesshash']").val(ProxmoxCloudVps_accesshash): $("select[name='accesshash']").val("pam") ProxmoxCloudVps_selectAdded = true; } function ProxmoxCloudVps_removeSelect(){ $( "#inputServerType").closest("tbody").find(" tr:eq(3)").find(" td:eq(0)").html(ProxmoxCloudVps_td1); $( "#inputServerType").closest("tbody").find(" tr:eq(3)").find(" td:eq(1)").html(ProxmoxCloudVps_td2); ProxmoxCloudVps_selectAdded = false } $(document).ready(function(){ var pc_ServerType = $( "#inputServerType").val(); ProxmoxCloudVps_accesshash = $( "textarea[name='accesshash']").val(); if(pc_ServerType=="ProxmoxCloudVps" || pc_ServerType=="ProxmoxCloudVps"){ ProxmoxCloudVps_addSelect(); } $( "#inputServerType").change(function(){ pc_ServerType = $( this).val(); if(ProxmoxCloudVps_selectAdded==true && pc_ServerType!="ProxmoxCloudVps" && pc_ServerType!="ProxmoxCloudVps" ){ ProxmoxCloudVps_removeSelect(); }else if(!ProxmoxCloudVps_selectAdded && pc_ServerType=="ProxmoxCloudVps" || pc_ServerType=="ProxmoxCloudVps" ){ ProxmoxCloudVps_addSelect(); } }); });