Skip to content

Instantly share code, notes, and snippets.

@cgravolet
Created September 11, 2009 18:22
Show Gist options
  • Save cgravolet/185473 to your computer and use it in GitHub Desktop.
Save cgravolet/185473 to your computer and use it in GitHub Desktop.
Data bind
dataBind: function(data, ctrl){
var regexp = null;
for (var key in data) {
regexp = new RegExp("{" + key + "}","gi");
ctrl = ctrl.replace(regexp, data[key]);
}
return ctrl;
} // dataBind()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment