diff options
author | Felix Nagel <info@felixnagel.com> | 2013-04-30 23:40:53 +0200 |
---|---|---|
committer | Felix Nagel <info@felixnagel.com> | 2013-04-30 23:40:53 +0200 |
commit | 255d4f6d0a3394102d04bf0e3cdd9bea14c0bf03 (patch) | |
tree | dff047558a419d6946a8bdc90d9b498e8a356d9a /demos | |
parent | 7715c71a9f78f23f1beecefb8838bc121db56699 (diff) | |
download | jquery-ui-255d4f6d0a3394102d04bf0e3cdd9bea14c0bf03.tar.gz jquery-ui-255d4f6d0a3394102d04bf0e3cdd9bea14c0bf03.zip |
Selectmenu; improve HTML building in custom render demo
Diffstat (limited to 'demos')
-rw-r--r-- | demos/selectmenu/custom_render.html | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/demos/selectmenu/custom_render.html b/demos/selectmenu/custom_render.html index 03f873d19..941c94da6 100644 --- a/demos/selectmenu/custom_render.html +++ b/demos/selectmenu/custom_render.html @@ -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 ); |