Skip to content

Commit

Permalink
Selectmenu; improve HTML building in custom render demo
Browse files Browse the repository at this point in the history
  • Loading branch information
fnagel committed Apr 30, 2013
1 parent 7715c71 commit 255d4f6
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions demos/selectmenu/custom_render.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,20 @@
$(function() {
$.widget( "custom.iconselectmenu", $.ui.selectmenu, {
_renderItem: function( ul, item ) {
var element, span,
var a, span,
li = $( "<li>" );

if ( item.disabled ) {
li.addClass( "ui-state-disabled" ).text( item.label );
} else {
element = item.element;
a = $( "<a>", {
text: item.label,
href: "#"
}).appendTo( li );
span = $( "<span>", {
style: element.attr( "style" ),
"class": "ui-icon " + element.attr( "class" )
});
$( "<a>", {
text: item.label,
href: "#"
})
.append( span )
.appendTo( li );
style: item.element.attr( "style" ),
"class": "ui-icon " + item.element.attr( "class" )
}).appendTo( a );
}

return li.appendTo( ul );
Expand Down

0 comments on commit 255d4f6

Please sign in to comment.