Your JSON data doesn't just "get modified" out of the blue. Somewhere, some
JavaScript code modifies it. That's where you need to do your updating.

You don't need magic, you just need a function call.

Regarding the HTML generation, there are a number of ways to do that. What
you pick may depend on the performance impact: There are more elegant ways
that are slower, and less elegant ways that are faster. If you have
questions in that area, give an idea of how much data you're talking about.

-Mike

On Mon, Sep 28, 2009 at 11:49 PM, Cory <[email protected]> wrote:

>
> Hi All,
>
> I'm new to the discussion boards so my apologies if this question has
> been answered, (I searched but maybe I wasn't calling it the right
> thing.)
>
> I'd like to create a JSON backing data structure that will update a
> DOM element when updated itself. I've seen tons of examples on how to
> create custom events to fire when the DOM changes, but not when the
> JSON object is modified.
>
> I have a simple Observer/Observable pattern setup to update the DOM
> whenever one of the "registered" elements' backed data is modified,
> but it far from elegant.
>
> Is there a simple solution to this?
>
> ex:
>
> data = {
>  name: "Cory",
>  hobbies: "coding",
>  age: 28
> }
>
> and
>
> <div bindname="name">Fred</div>
> <textarea bindname="hobbies">cutlery</textarea>
> <input type="text" bindname="age" value="22"></input>
>
> when any of the JSON fields change, it updates the DOM.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to