$(document).ready(function(){ // add new qualifications hidden form // $('#qualification-add').hide(); // $('#qualification-add-button').click(function(e){ // e.preventDefault(); // $('#qualification-add').show(); // $(this).hide(); // }) function updateQualificationType(){ var changedElement = $('#qualification-type input:checked'); var isMedical = 'medical'; if (changedElement.val() == isMedical) { $('#add-medical-qualification').show(); $('#add-other-qualification').hide(); } else { $('#add-other-qualification').show(); $('#add-medical-qualification').hide(); } } // switch qualification type $('#add-medical-qualification').add('#add-other-qualification').hide(); $('#qualification-type input').click(function() { updateQualificationType(this); }); if ($('#qualification-type input').length > 0) { updateQualificationType() } // hide all "other" elements var toggleOther = function(e){ var selectElement = $(this); if (selectElement.find('option:selected').is('.other')) { // show next element with 'other class' selectElement.parent().find('.other').not('option').show(); } else { selectElement.parent().find('.other').not('option').hide(); } }; $('.other').not('option').hide(); $('option.other').parent().change(toggleOther); // disable member navigiation $('body.member #content-outer-tabs a').attr('href', '#') .click(function(e){e.preventDefault()}) .parent() .animate({opacity: 0.3}); if ($('#general-custom-url').length > 0) { var customUrlField = $('#general-custom-url'); var availabilityContainer = $('
'); customUrlField.parent().parent().append(availabilityContainer); var updateField = function(response){ var element = $(response); element.find('a').click(function(e){ e.preventDefault(); customUrlField.val($(this).text()); availabilityContainer.empty(); }); availabilityContainer.empty(); availabilityContainer.append(element); }; var checkAvailabilityBtn = $(''); checkAvailabilityBtn.click(function(e){ e.preventDefault(); $.get('/members/checkurl.php', { 'profile': $('#profile-id').val(), 'attempt': customUrlField.val() }, updateField, 'html'); }); customUrlField.parent().append(checkAvailabilityBtn); } if ($('#practice-custom-url').length > 0) { var customUrlField = $('#practice-custom-url'); var availabilityContainer = $('
'); customUrlField.parent().parent().append(availabilityContainer); var updateField = function(response){ var element = $(response); element.find('a').click(function(e){ e.preventDefault(); customUrlField.val($(this).text()); availabilityContainer.empty(); }); availabilityContainer.empty(); availabilityContainer.append(element); }; var checkAvailabilityBtn = $(''); checkAvailabilityBtn.click(function(e){ e.preventDefault(); $.get('/members/practice/checkurl.php', { 'profile': $('#practice-id').val(), 'attempt': customUrlField.val() }, updateField, 'html'); }); customUrlField.parent().append(checkAvailabilityBtn); } });