Trying to figure out if there’s a more succinct or elegant way to write the code below. I’m replacing any slashes in a text box with dashes, then applying a validation rule to the textbox using a custom format string:
var bday = $("#home-birthday");
var bdayVal = bday.val();
bday
.val(bdayVal
.replace(/\//g, '-')
)
;
bday
.rules("add", {
mydate: true
})
;
I’ve had a few variations, but figured I’d just throw it up here and see if there’s a better way.
1 Answer