fnagel/jquery-ui — Issue #176: JS error if <select> has no id="" attr
Author: thg2k
Created: 2011-10-14 03:40:35+00:00
State: open

In this line

// set a default id value, generate a new random one if not set by developer
var selectmenuId = this.element.attr( 'id' ).replace(':', '\\:') || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 );

you call method ".replace()" to undefined

I fixed it in this way

// set a default id value, generate a new random one if not set by developer
var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 );

// escape special characters
selectmenuId = selectmenuId.replace(':', '\\:');