I'm working on a simple editor where I can see the changes as I type
them.  I got the idea figured out, but I'm selecting everything
individually.  Here's JS of the one that I have working right now:

$(document).ready( function () {
        $('#newsEdit').focus( function() {
                editing = "news";
        });

        $('#newsEdit').blur( function() {
                editing = "none";
        });

        $('#newsEdit').keyup( function() {
                if(editing == 'news') {
                        $('#news').html( $('#newsEdit').val() );
                }
        });
});

var editing = "none";

What I would like to do though, is not have to add each one
individually, so that I can maybe just select everything with a
certain class, and the <input> and <textarea> tags would be set with
these types of commands.  So, if I add another <input> and
corresponding <p> (or something) it will automatically be ready to
go.  I'm just not sure how to do that.  I think it has something to do
with .children, but the examples in the documentation don't help me
with this right now.  If someone can point me the direction I need to
be going, that would be great.  Thanks.

Reply via email to