Home > Software engineering >  Laravel 8.x - Creating copies of a toast markdown editor in laravel blade
Laravel 8.x - Creating copies of a toast markdown editor in laravel blade

Time:12-29

This is a noobie question . I am trying to create multiple copies of toastui editor using the following code, but i am not getting the desired output. Please tell me what i am doing wrong here.

<div >
        <div >
            @for($i=0;$i<10;$i  )
            <div >
            <div >
    <label for="editor" >Content</label>
    <div id="editor" ></div>
</div>
            </div>
            @endfor
        </div>
    </div>

CodePudding user response:

        @for($i=0;$i<10;$i  )
            <div >
                <div >
                    <label for="editor" >Content</label>
                    <div id="editor-{{$i}}" ></div>
                </div>
            </div>
        @endfor

In script tag :

 for(let i=0; i<10; i  ){
      const editor = new toastui.Editor({
        el: document.querySelector('#editor' i),
        previewStyle: 'vertical',
        height: '500px',
        initialValue: content
      });
    }
  • Related