Hasan Othman
Hasan Othman

Reputation: 78

How to open Bootstrap ModalBox in Webpart React

I have a sharepoint solution built in react template and would like to create just modalbox based on bootstrap.

i have imported the following libaries

it works just fine. i can use both of them.

Questions before the start:

Is it possible anyway to open popup window (this modalbox) under sandbox environment of sharepoint?

if yes, do i need Administrator access to enable this?

if no (and that's actually what i supposed), how i can implement this with pure Jquery (as i said before, the solution built in React).

if the Implementation with Jquery almosty is'nt possibale, then is there any easy way to implement the modalbox functionality based on React.

what i have tried:

import * as $ from 'jquery';
import * as bootstrap from "bootstrap";
import "bootstrap/dist/css/bootstrap.min.css";

export default class DemoWebPart {
              public render(): void {
                             this.domElement.innerHTML = "<div id="myModal">< 
                </div><button onclick=klickibunti()>test</button>";

                 function klickibunti(){
                   $('#myModal').modal("show"); // doesn't work!
                      }
           }
}

Upvotes: 1

Views: 41

Answers (0)

Related Questions