As shown in the figure, why can't you see the option when the select, generated dynamically at the front end is selected?

 var fontSizeEl = $("<select size="4" class="form-control fontSize-select"></select>");
    fontSizeEl.append("<option value="10px">10</option>");
    fontSizeEl.append("<option value="14px">14</option>");
    fontSizeEl.append("<option value="16px">16</option>");
    fontSizeEl.append("<option value="20px">20</option>");    
    fontSizeEl.val(editor.getFontSize());
    fontSizeEl.click(function(e) { // 
        if (!$(e.target).hasClass("emotion")) {
          var size = $(e.target).val();
          editor.fontSize(size);
        }
    });
    $(this).append(fontSizeEl); // 
Apr.04,2021

Don't bind the click event to the current element, bind it to the parent or document


  1. if you use the native select/option to write this, the original style is more difficult to overwrite.
  2. but if the requirement is not high, you can simply cover it. For example, what you said should be caused by margin and so on.
  3. if you use the CSS library, it is recommended to check that some styles are assigned to option,. This should be due to the fact that there is no corresponding style assigned to you
  4. or write your own style using div
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3be88-41311.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3be88-41311.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?