How to remove the x button in modal mode?

is there any way to remove the close button (x) in the upper right corner of the modal? The reason I need this is because the modal form contains the required form, and I don't want the user to avoid it.

by email Oh I didn’t understand that the close button is actually explicitly added to the inserted code

<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> 

I though it was a sign of modal. Unfortunately

+6
source share
3 answers

You can remove the close markup and use the data-backdrop="static" and data-keyboard="false" attributes to prevent it from closing ...

http://www.bootply.com/43VI44Y3lG

+8
source

Since this is the code for the x button:

 <button data-dismiss="modal" class="close" type="button"> <span aria-hidden="true">×</span> <span class="sr-only">Close</span> </button> 

Just use this css:

 .close {display: none;} 
+7
source

From the Bottrerap modal code

  <div class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> <h4 class="modal-title">Modal title</h4> </div> <div class="modal-body"> <p>One fine body&hellip;</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-default" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary">Save changes</button> </div> </div><!-- /.modal-content --> </div><!-- /.modal-dialog --> </div><!-- /.modal --> 

Delete line from code above

  <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button> 

I think this helped you remove the close button.

+6
source

Source: https://habr.com/ru/post/973486/


All Articles