Skip to content
This repository has been archived by the owner on Aug 15, 2021. It is now read-only.

Uncaught TypeError: Cannot read property 'length' of undefined, Line 16: preview_textarea.publish.js #6

Closed
fawx opened this issue Aug 21, 2012 · 1 comment

Comments

@fawx
Copy link

fawx commented Aug 21, 2012

this may be related to using jonas's markdown editor, but $(this).parent().find("textarea") does not find a textarea. changing this line to $(this).closest("div").find("textarea") solves the issue, but may not be relevant to other extensions which modify the textarea.

@tachyondecay
Copy link
Owner

Good catch. Looks like Markdown Editor moves the textarea element outside the label container, so the textarea and the preview link no longer share the same parent.

I changed it to $(this).closest('div.field').find('textarea'), which hopefully future-proofs it against any extensions that wrap the label or textarea in extra divs. Also, thanks for the recommendation—I haven’t seen .closest() before!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants