最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Error: this.element.uniqueId is not a function. JQuery UI. Anyone seen this before? - Stack Overflow

programmeradmin1浏览0评论
<link rel="stylesheet" type="text/css" href=".8.9/themes/ui-lightness/jquery-ui.css" />
<script type="text/javascript" src="../Content/Scripts/jquery.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.core.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.position.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.menu.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.selectmenu.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.tabs.js"></script>

So that's the sum of my script and stylesheet imports, but when it attempts to "convert" one of the <select> elements to the JQuery UI Selectmenu, I get this error in Mozilla Web Developer in the jquery.ui.selectmenu.js, and the jquery esque theme is not applied.

I've seen similar errors before caused by the scripts being important in the wrong order and the method not existing, but can't seem to think what may be causing it here.

Any ideas would be fantastic, more code can be given if needed, but its just a <select> element with $('#exampleSelect').selectmenu(); applied to it.

<link rel="stylesheet" type="text/css" href="http://ajax.googleapis./ajax/libs/jqueryui/1.8.9/themes/ui-lightness/jquery-ui.css" />
<script type="text/javascript" src="../Content/Scripts/jquery.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.core.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.widget.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.position.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.menu.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.selectmenu.js"></script>
<script type="text/javascript" src="../Content/Scripts/jquery.ui.tabs.js"></script>

So that's the sum of my script and stylesheet imports, but when it attempts to "convert" one of the <select> elements to the JQuery UI Selectmenu, I get this error in Mozilla Web Developer in the jquery.ui.selectmenu.js, and the jquery esque theme is not applied.

I've seen similar errors before caused by the scripts being important in the wrong order and the method not existing, but can't seem to think what may be causing it here.

Any ideas would be fantastic, more code can be given if needed, but its just a <select> element with $('#exampleSelect').selectmenu(); applied to it.

Share Improve this question edited Jun 27, 2012 at 15:22 Sirko 74.1k19 gold badges154 silver badges189 bronze badges asked Jun 27, 2012 at 15:19 ChristianChristian 1673 silver badges13 bronze badges 4
  • hi @Christian, i have same problem, any solution? – Castro Roy Commented Jul 12, 2012 at 21:50
  • It is funny, i used Firefox to copy the source code of an example in this url, view.jqueryui./selectmenu/demos/selectmenu/default.html, i even copied the .js, saved all in my puter, now, i don't get this error anymore, but, still not working as it should – Castro Roy Commented Jul 13, 2012 at 15:04
  • No solution as yet :(. I'll try a similar thing. – Christian Commented Jul 19, 2012 at 8:25
  • Please, let me know if you get any workarround to this issue. – Castro Roy Commented Jul 22, 2012 at 14:24
Add a ment  | 

2 Answers 2

Reset to default 5

Just a random shot in the dark. According to jQuery UI 1.9 upgrade guide, the method .uniqueId() was only introduced in jQuery UI 1.9. Your version probably doesn't support said method, or you might be mixing different versions.

Change line 33 in jquery.ui.selectmenu.js from:

var selectmenuId = this.element.uniqueId().attr( "id" );

to:

var selectmenuId = this.element.attr( 'id' ) || 'ui-selectmenu-' + Math.random().toString( 16 ).slice( 2, 10 );

This will hopefully work.

发布评论

评论列表(0)

  1. 暂无评论