Ticket #3453 (closed enhancement: invalid)
append() etc functions to accept many arguments
| Reported by: | antix | Owned by: | flesler |
|---|---|---|---|
| Priority: | major | Milestone: | 1.3 |
| Component: | core | Version: | 1.2.6 |
| Keywords: | multiple arguments, append, prepend, before, after | Cc: | |
| Blocking: | Blocked by: |
Description
for example
var $container = $("<div />"); var $input = $("<input />"); var $okButton = $("<button>Ok</button>"); var $CancelButton = $("<button>Cancel</button>");
$container.append($input, $okButton, $cancelButton);
This way you have references to the content to add events etc and only one call to append()
It would also apply to prepend(), before() and after()
to maintain the ability to change these functions in the future you could let it accept an array
for example $container.append([$input, $okButton, $cancelButton]);
Change History
comment:1 Changed 5 years ago by flesler
- need changed from Review to Patch
- Status changed from new to assigned
- Component changed from unfilled to core
comment:2 Changed 5 years ago by dmethvin
I'm not clear on what the enhancement is here; you can already pass multiple arguments to append, prepend, etc. by virtue of the code in jQuery.clean that checks for array-like arguments. This has worked for a long time:
$(function(){
var a = $("<div>hello</div>");
var b = $("<div>there</div>");
var c = $("<div>guys</div>");
$("#test").append(a,b,c);
});
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
