Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Hide id subfield in eprints workflow
function hideMailfield() {
var ths = document.querySelectorAll('[id*="_creators_th_"], [id*="_editors_th_"]');
var inputs = document.querySelectorAll('[class*="ep_eprint_creators_id"], [class*="ep_eprint_editors_id"]');
var tds = [];
ths.forEach(function(item) {
if (/^.*mail.*$/gmi.test(item.innerHTML))
{
item.style.display = "none";
}
});
inputs.forEach(function(input) {
tds.push(input.parentNode);
});
tds.forEach(function(td) {
td.style.display = "none";
});
}
// Run this when the page is loaded...
document.observe("dom:loaded", hideMailfield);
// ... and after an ajax button has been clicked (e.g. "add more rows")
Ajax.Responders.register({onComplete: hideMailfield});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment