You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<br />In jQuery 1.5, the behavior of $(plainObject).data() has been modified. In order to work against all versions of jQuery including jQuery 1.5,
11
+
<br />In jQuery 1.5, the behavior of $(plainObject).data() has been modified. In order to work against all versions of jQuery including jQuery 1.5,
12
12
current builds of jquery-datalink have therefore been modified as follows:
13
13
<ul>
14
14
<li>The API to modify field values is now .setField( name, value ), rather than .data( name, value ). (Examples below).</li>
@@ -39,15 +39,15 @@ $().ready(function() {
39
39
40
40
$("[name=name]").val("NewValue"); // Set firstName to a value.
41
41
alert(person.name); // NewValue
42
-
42
+
43
43
$(person).setField("name", "NewValue");
44
44
alert($("[name=name]").val()); // NewValue
45
-
45
+
46
46
// ... user changes value ...
47
47
$("form").change(function() {
48
48
// <user typed value>
49
-
alert(person.name);
50
-
});
49
+
alert(person.name);
50
+
});
51
51
});
52
52
</script>
53
53
@@ -100,10 +100,10 @@ $().ready(function() {
100
100
convert: "round"
101
101
}
102
102
});
103
-
103
+
104
104
/* Once the user enters their age, the change event will fire which, in turn, will
105
-
* cause the round function to be called. This will then round the age up or down,
106
-
* set the rounded value on the object which will then cause the input field to be
105
+
* cause the round function to be called. This will then round the age up or down,
106
+
* set the rounded value on the object which will then cause the input field to be
107
107
* updated with the new value.
108
108
*/
109
109
$("#age").change(function() {
@@ -157,7 +157,7 @@ $("#name").val("18");
157
157
alert(person.canVote); // true
158
158
</pre>
159
159
<p>
160
-
In this example, the converter sets two fields on the target, and neglects to return a value to cancel the default operation of setting the age field.
160
+
In this example, the converter sets two fields on the target, and neglects to return a value to cancel the default operation of setting the age field.
161
161
</p>
162
162
<p>
163
163
Converters can also be specified for the reverse process of updating the source from a change to the target. You can use this to customize the attribute used to represent the value, rather than the default of setting the 'value'.
0 commit comments