javascript - listbox return wrong value in wordpress3.9 -
I used the listbox UI element in Wordpress 3.8, but it does not work in my new version (3.9) is. I have written this JS code to test it:
(function () {var Icons; var icon = function {ID} {return '& lt; i class = "fa fa- '' Arrow-Circle -O-Right "," Arrow-Circle-O-Left "," Arrow-Circle-O-Left "," Arrow-Circle-O-Left "," Carat-Square-O-Byte "," Toggle-Byte "," Dot-Circle-O "," Wheelchair "," Vameneo-Square "," Try "," Adjust "," Anchor "," Collection "," Arrows "," arrow-h "," arrow-v "," asterisk "," ban "," bar-chart-o "," barcode "," "Bare", "Bell", "Bell", "Bell-O", "Bolt", "Book", "Bookmark", "Bookmark-o", "Briefcase", "Bug"] var menu = []; For (var i = 0; I & lt; ICONS.length; i ++) {var _id = ICONS [i]; menuval.push ({text: icon (_id) + '' + _id, onclick: function () {Setcantfone (_id)}};} Tinymce.PluginManager.add ("font_awesome_glyphs", function (editor, url) {var menucreate = editor.addButton ('fontAwesomeGlyphSelect', {type: 'listbox', text: 'icons' , Icon: wrong, value: menu)};}); function set contentfun (id) {warning}; Return false;}}) (); It displayed a listbox, but when I click on the menu item instead of alerting the last element of the "Icon" array, it displays all the elements of the listbonds. I made some updates to my items:
/ p>
var menu = []; Var insertVar = function (val) {return function () {editor.insertContent (val); }}; (Var i = 0; i & lt; SHORTCODES.length; i ++) for {var _id = SHORTCODES [i]; var _code = SHORTCODE_EXE [i]; Var variable = insertVar (_code); // Alert (_id + '' + SHORTCODES [i] + "+ SHORTCODE_EXE [i]); Menuval.push ({text: _id, onclick: variable}); }
Comments
Post a Comment