javascript - How to hide wmd editor initially? - Stack Overflow

<div style="display:none;"><div id="wmd-editor" class="wmd-panel"

<div style="display:none;">
    <div id="wmd-editor" class="wmd-panel">
        <div id="wmd-button-bar"></div>
        <textarea id="wmd-input"></textarea>
    </div>
    <div id="wmd-preview" class="wmd-panel"></div>
    <div id="wmd-output" class="wmd-panel"></div>   
</div>  

See,I'm following wmd-test.html of derobins-wmd,except put that stuff inside a hidden div.

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
<div style="display:none;">
    <div id="wmd-editor" class="wmd-panel">
        <div id="wmd-button-bar"></div>
        <textarea id="wmd-input"></textarea>
    </div>
    <div id="wmd-preview" class="wmd-panel"></div>
    <div id="wmd-output" class="wmd-panel"></div>   
</div>  

See,I'm following wmd-test.html of derobins-wmd,except put that stuff inside a hidden div.

uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
uncaught exception: [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIDOMNSHTMLTextAreaElement.selectionStart]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: http://localhost/derobins-wmd-980f687/wmd.js :: anonymous :: line 490" data: no]
Share Improve this question asked Oct 4, 2009 at 12:30 MisierMisier 1,5334 gold badges13 silver badges15 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 8

In addition to hiding the whole panel with textarea inside of it, you need to make sure that textarea itself has display:none and problems will disapear then. Otherwise wmd will not detect that textarea is not displaying and will try to do calculations on it and you will get exceptions like you said.

Simply putting elements off screen is not possible or at least very troublesome with some layouts. Furthermore, screenreaders will still detect those elements and accessibility will suffer.

I guess you solved the issue by now, but I hope it will help someone.

You might use the off-left technique, if the plugin doesn't like the elements not having height/width.

<div style="position: absolute; left: -1000px; width: 100px">

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745656309a4638563.html

相关推荐

  • javascript - How to hide wmd editor initially? - Stack Overflow

    <div style="display:none;"><div id="wmd-editor" class="wmd-panel"

    4小时前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信