Drupal modules for browsing and managing Fedora-based digital repositories.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

30 lines
933 B

$(document).ready(function () {
$('.otherSelect').each(function (index)
{
var name = $(this).attr('name').replace(/[\[\]]+/g,'-');
$(this).attr('id',name);
$('#'+name+' option:last').after('<option value="other">Other</option>');
$(this).after('<div id="'+name+'_other" style="display: none">Other Value:<input type="textfield" name="'+name+'" value="'+$(this).val()+'" id="'+name+'_field"/></div>');
$(this).removeAttr('name');
$(this).change(function ()
{
if ($(this).val() == 'other')
{
$('#'+$(this).attr('id')+'_field').val('');
$('#'+$(this).attr('id')+'_other').show('fast');
} else
{
$('#'+$(this).attr('id')+'_field').val($(this).val());
$('#'+$(this).attr('id')+'_other').hide('fast');
}
});
});
});