0

I'd like to add a placeholder attribute to a textarea Matrix cell in a SafeCracker form (so I can add some placeholder text to the field that says, 'Add your feedback here...'), and I'm using EE 2.5.5 and Matrix 2.5.6.

I don't want to hack any of the Matrix files to do this, so was hoping someone might have used a JavaScript solution for this previously and be able to share the code.

Here's the front-end output for this particular Matrix cell, and the entire Matrix field is surrounded by a div with an ID of cf_amendment_details. Thanks for any help with this.

<td class="matrix matrix-last matrix-text"><textarea class="matrix-textarea" name="cf_amendment_details[row_new_0][col_id_19]" rows="1" dir="ltr"></textarea></td>

1 Answer 1

0

This is the JavaScript I've ended up using to add a placeholder to the first row of the Matrix cell:

$('#cf_amendment_details').find('.matrix-textarea').attr('placeholder', 'Add your feedback here');

Couldn't get it working for every row, due to how the rows are added on-the-fly, but this will be fine.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.