在jQuery函数上传递多个id

met*_*lah 0 jquery

你如何在jQuery函数上传递多个元素?

到目前为止这是我的代码:

HTML

<textarea id="hello">This is the default text</textarea>
<input id="hello2" value="This is another text box">
Run Code Online (Sandbox Code Playgroud)

JavaScript的

$(function() {
    $('#hello', '#hello2').each(function() {
        $.data(this, 'default', this.value);
    }).focus(function() {
        if (!$.data(this, 'edited')) {
            this.value = "";
        }
    }).change(function() {
        $.data(this, 'edited', this.value != "");
    }).blur(function() {
        if (!$.data(this, 'edited')) {
            this.value = $.data(this, 'default');
        }
    });
});
Run Code Online (Sandbox Code Playgroud)

演示:http://jsfiddle.net/eJP9C/252/