dynamic variable in event bind
<p>I'm having a problem binding a dynamic event in jQuery. What I want to achieve is to have an event that acts on a variable that has previously been set. For example I have</p>

<pre><code>someFunc = function (form_id)
{
    $("input").bind("focus", function ()
    {
        $("#"+form_id).css({"border":"1px solid red"});
    });
}

someFunc("edit_form");
somefunc("add_form");
</code></pre>

<p>Now this is a large simplification of what I'm looking to do but the dynamic nature of a variable when binding is what I need. The problem here is that essentially I want jQuery to execute on whatever "form_id" was when the bind was applied but instead it will execute on whatever the "form_id" is when the focus is triggered.</p>

<p>I understand why this occurs, my question is how can I achieve the functionality I'm looking for. (Again form here is just an example, not an actual bit of functionality).</p>

<p><strong>Edit 1:</strong></p>

<p>This is probably a better example of what I'm trying to achieve:</p>

<pre><code>Dog.prototype = {
    name: "Dog",

    bind_function : function ()
    {
        name = this.name;

        $(name+"_edit_form input[name='something']").bind("focus", function ()
        {
            console.log(name);
        })
    }
}

function Dog() {
    this.breed = "Chihuaha";
}

Rover = new Dog();
Rover.bind_function();

Fido = new Dog();
Fido.bind_function();
</code></pre>

<p>Now I want focus to produce a console log of that particular dogs name, but at present it will just console log the last dog's name?</p>
