The fastest way to create the entire DOM you want to add as a string, and then attach to the document as html() :
var dom = '<a href="http://www.example.com" class="footerLink" rel="external">example</a>'; $(element).html(dom);
Of the three that you have in your example, the fastest should be the third, for the reason that it does not need to perform any complex parsing of strings, and the attributes are not placed using a chain of function calls, but are provided as single objects in as a parameter for the selector.
There is a forum question in jQuery that you can check.
Update:
If you are creating many elements for an element, then you definitely need to use a string approach. Take a look at the following example of creating 1000 list items.
// Assume we have data defined with 1000 data members // each containing a text property var list = []; for (var i = 0; i < data.length; i++) { list.push('<li>' + data.text + '</li>'); } $(ul).html(list.join(''));
source share