jquery.dform icon indicating copy to clipboard operation
jquery.dform copied to clipboard

$.val on hidden element does not work

Open Ampersandy-zz opened this issue 14 years ago • 2 comments

Since the value subscriber is simply inserting a string value, why is .val being used to set the contents? I'm guessing this is so that custom elements with closing tags are also updated.

That being said, the .val method does not update the contents of a form field if it or a parent element is hidden with style="display:none".

I'm creating my form and inserting it into another div which is popped up as a modal dialog. Since the form is being created pre-modal, it's value is not updated. Perhaps the documentation should mention something about this, it was just the cause of nearly an hour of frustration.

Ampersandy-zz avatar Jun 27 '12 06:06 Ampersandy-zz

I don't think I follow. Can you please fork this jsFiddle: http://jsfiddle.net/Zt4Rz/ and update it to illustrate your problem? Setting the value on elements with display: none; worked fine in my tests.

daffl avatar Jun 27 '12 14:06 daffl

I had fixed the issue in my code and posted this after the fact; I can't even reproduce it, and in fact the current behaviour is in line with what you just said. Sorry about that.

Ampersandy-zz avatar Jun 30 '12 03:06 Ampersandy-zz