I update the Backbone Model with ...
if it is empty when the control gains focus.
code snippet :
events :{
"focusin input" : "updateCell"
},
updateCell: function(event) {
if(_.isEmpty(event.target.value)){
var inputID = event.target.id;
var value = "...";
var attribute = {};
attribute[inputID] = value;
this.model.set(attribute);
}
}
This works fine and update the model
if it is empty but ...
is appended with the value.
Instead I want to remove ...
when the user starts to enter the value and some cases the focus
might have come to one control and the user could have skipped without entering anything. So I want to remove the ...
also when saving the data to server.
Please help me to solve these two problems. It is fine even if I have to go with
jquery or underscore.js etc
remove the value attribute for the default value, instead, use the placeholder attribute. When the user will click on the field, the placeholder text in your case "..." will disappear automatically.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.