Good morning everyone \ afternoon \ evening \ night.
How to tie a JscrollPane to a textarea , so that the scroll itself is located outside the textarea ?

CSS:

 #chat { width: 325px; height: 260px;} 

Js:

 $(function(){ $('#chat').jScrollPane(); }); 

    2 answers 2

    It is unlikely that this plugin is suitable for <textarea> , can instead of <textarea> use <div> with the attribute contenteditable ?

    • If you honestly did not even know about this property, I will try. - Roman
    • @ Roman, this property allows you to edit the contents of the <div> , so you can simulate textarea to get the text in the block, you only need to refer not to element.value , but to element.innerHTML . - ThisMan

    So what's the problem then? You have written the initialization correctly, and to get it out of the textarea look at what class is assigned to the element after initialization and write a style with something like

     position: absolute; right: -8px; 

    Also, do not forget to put the parent element

     position: relative; 

    so that absolute positioning takes place relative to it.

    • The problem is that the 'scroll' does not appear if the content is less than the region. And content i. text inside the textarea is not counted by the plugin. - Roman
    • Then that's right, it's better to use a div with contenteditable = "true", as suggested by @ThisMan - FFFFFF
    • Grateful. Gone to do. - Roman