Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Linking from textarea picks up old value #2

perokvist opened this Issue May 11, 2011 · 10 comments


None yet
4 participants

If fromHandler is "html" and $source is a textarea element, the value is picked up from the textarea element property "text".
However, this is the old unchanged value, so the linking does not work properly.

(The new value is found in the "value" property of textarea. Changing "text" to "value" seems to work fine.)

Update: although, it seems to introduce problems in IE8...

webwurst commented Jul 4, 2011

I tried with adding this to line 654 in jquery.views.js:

textarea: {
    from: {
        fromAttr: inputAttrib
    to: {
        toAttr: "value"

But seems I do not understand enough of the source code, did not work..

Can someone help out?

webwurst commented Jul 5, 2011

Ok Firebug is now my friend ;)

In jquery.views.js:32 we check

"$( source ).is( link.from )" 

where source maybe "textarea", but link.from is always:

"input[" + settings.linkToAttr + "]"

because of line 337.

@webwurst webwurst pushed a commit to webwurst/jsviews that referenced this issue Jul 5, 2011

Tobias Bradtke lean workaround for issue #2 while seeking for more wisdom 38e5e10

BorisMoore commented Jul 6, 2011

I plan to add correct support for textarea, along with select, and inputs of various types in addition to text and checkbox etc. Hope to get to it before too long :)

webwurst commented Jul 8, 2011

Great! Will it maybe also be possible to link the content of any element with data-to?

Instead of a textarea I would like to use a div with the HTML5-attribute "contenteditable" and use for example the Aloha Editor on that.

blowsie commented Jan 23, 2012

Hi , i was just wondering what the progress on this issue was, I was wondering if its worth writing my own hack for now or awaiting the next update.

In my opinion the following need to be considered for linking.

Input (all types, radio, checkbox, text etc)
content editable.

ps. I have written a jquery plugin to trigger the change event on contenteditable elements.
Let me know if you wish me to share it.


BorisMoore commented Jan 23, 2012

Hello. I am working hard on moving JsRender towards a final beta API, and making good progress. (It is not visible progress yet, because it will involve a few breaking changes, so I don't want to commit yet - until I am confident enough of the design and have worked through some integration aspects with JsViews to make sure we have compatibility there too.) The plan is to get JsRender to beta (officially the goal is the end of February. May be slightly sooner), and then move to getting JsViews also to beta (goal April...). The JsViews beta will need to include at least inputs, textarea and select. Currently select is tricky because of some issues in IE, but the beta should allow that to work too.

So it may be a little while before you get those features in JsViews, and you may prefer to write your hack if you need it sooner. On content editable, that is also a goal, but probably not for the beta. Is your plugin in on GitHub? If so, do send me a link. (But I may not look at it for a while...)


BorisMoore commented May 10, 2012

This issue has been fixed in the latest commit: (pre beta commit counter: 8).
Binding to textarea now supported, with demo here:

@BorisMoore BorisMoore closed this May 10, 2012

blowsie commented Jun 4, 2013

Boris, do you have any plans to create a changeHandler for html5 contenteditable?

blowsie commented Jun 4, 2013

This is the change event I wrote, you asked to take a peek a while back.

(function ($) {
    $.fn.wysiwygEvt = function () {
        return this.each(function () {
            var $this = $(this);
            var htmlold = $this.html();
            that.bind('blur keyup paste copy cut mouseup', function () {
                var htmlnew = $this.html();
                if (htmlold !== htmlnew) {

You can simply call $('.wysiwyg').wysiwygEvt();

Id image this isn't much use in jsviews tho.


BorisMoore commented Jun 7, 2013

@blowsie: No plans right now. But it would be a good feature request, and if you want to create an issue to track it, I will triage it, probably as a post V1.1 feature request. Thanks...! We can link the issue (if you create one) back to here, and your code example...

@aredridel aredridel pushed a commit to blumenthals/RapidWeb that referenced this issue Jan 18, 2014

@BorisMoore BorisMoore Added support for data-linking to textarea elements (BorisMoore/jsvie…

Improved sample for form elements, and included textarea example.
Integrated updated design for #index, from JsRender.
Signed-off-by: Boris Moore <borismoore@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment