k_rizza
11-10-2009, 02:11 PM
I am trying to create a custom method for all Strings.
var chkStr = {
isBlank: function() {
if (this.length < 1) return false;
else return true;
},
}
String.prototype.isBlank = new chkStr.isBlank;
Later in a function I check the value of a form entry
if (form.formName.field.value.isBlank) {
alert('You left something blank.');
}
I am getting a myStr.isBlank is not a function error.
var chkStr = {
isBlank: function() {
if (this.length < 1) return false;
else return true;
},
}
String.prototype.isBlank = new chkStr.isBlank;
Later in a function I check the value of a form entry
if (form.formName.field.value.isBlank) {
alert('You left something blank.');
}
I am getting a myStr.isBlank is not a function error.