We can resolve this problem in two ways.

1. We can add $('#myModal').modal({backdrop: 'static', keyboard: false})

OR

2.We cam add data-backdrop="static" data-keyboard="false" in <button data-target="#myModal" data-toggle="modal" data-backdrop="static" data-keyboard="false">

BY Best Interview Question ON 25 Jan 2019