/ Published in: jQuery
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var anchor = $('<a />', { className: 'awesome', href: '#', text: "This is an anchor ", click: function(e){ e.preventDefault(); $(this).parent().slideToggle(); } }); $("li").each(function(){ $(this).prepend(anchor.clone()); });
URL: http://thenerdary.net/articles/entry/beautiful_element_creation_with_jquery#When:16:29:12Z