Skip to content

Retrieve Parameters

Adam McArthur edited this page Jan 25, 2015 · 4 revisions

If at some point you've added some parameters to your Instance Model, you can retrieve them at any time. Perhaps you might want to use them to show the person's name in a thank you message? Yeah that sounds cool, let's do that...

var ContactForm = new Instance();

.get( attribute );

var name = ContactForm.get("name");

alert("Thanks, " + name + ". Your message has been sent!");

You can also get all of the attributes associated with the Instance by leaving out the arguments from the .get() method:

var all_parameters = ContactForm.get();

console.log(all_parameters);
// => { name: "Adam", email: "blah", message: "Hello, world!" }

Want to contribute to instance.js? Find out how.

Clone this wiki locally