Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save salsalabs/1bf232cad6cb2102e924 to your computer and use it in GitHub Desktop.

Select an option

Save salsalabs/1bf232cad6cb2102e924 to your computer and use it in GitHub Desktop.
Workaround to make multi-line custom donation fields appear as <textarea> tags.
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script type="text/javascript">
// See https://salsasupport.zendesk.com/forums/21464331
// Requires: Any fairly modern version of jQuery.
//
$(document).ready(function () {
// You do this. Put the API names of the multi-line donation custom fields
// between the quotes. Separate them with commas. If there is only one
// field name, simply type it between the quotes without any commas.
//
var field_names = "field_1_api_name,field_2_api_name,you_get_the_idea".split(' ');
$.each(field_names, function (index, name) {
var e = $('input[name=' + name + ']');
if (e.length > 0) {
var id = e.attr('id');
var title = e.attr('title');
var text = [ '<textarea id="' + id + '"',
'name="' + name + '"',
'value=""',
'class="blockInput"',
'title="' + title + '"></textarea>'
].join(' ')
e.parent().append(text)
e.remove()
}
})
})
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment