Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable clicking out of pop-up to exit? [duplicate]

I created this pop-up box on my website:

enter image description here

with the following code:

<div class="modal custom fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<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" id="myModalLabel">Upload a Meme</h4>
        </div>
        <div class="modal-body">
            <div class="input-group">
                <input type="text" class="form-control" placeholder="Url: http://" id="urlInput">
                <input type="text" class="form-control" placeholder="Title" id="titleInput">
                <input id="saveComments" type="text" class="form-control" placeholder="Comments">
                <input type="text" class="form-control" placeholder="Tags" id="tagInput">
            </div>
            <br>
            <h4>&nbsp;Rate It:</h4>
            <div class="rating pull-left">
                <input type="radio" id="stars5" name="rating" value="5" /><label for="stars5" title="Rocks!">5 stars</label>
                <input type="radio" id="stars4" name="rating" value="4" /><label for="stars4" title="Pretty good">4 stars</label>
                <input type="radio" id="stars3" name="rating" value="3" /><label for="stars3" title="Meh">3 stars</label>
                <input type="radio" id="stars2" name="rating" value="2" /><label for="stars2" title="Kinda bad">2 stars</label>
                <input type="radio" id="stars1" name="rating" value="1" /><label for="stars1" title="Sucks big time">1 star</label>
            </div>
        </div>

        <div class="modal-footer">
            <button type="button" class="btn btn-default cancel" data-dismiss="modal">Cancel</button>
            <button type="button" class="btn btn-default submit" id="saveSubmit"><b>Submit</b></button>
        </div>
    </div>
</div>

I have a cancel button and a submit button. The cancel button exits the pop-up but a user can also click outside the Upload window to exit.

How can I prevent clicking outside the box to exit?

Thanks

like image 389
user1631224 Avatar asked Oct 21 '22 04:10

user1631224


1 Answers

Try adding these two strings to your HTML element: data-backdrop="static" and data-keyboard="false".

Setting data-backdrop to static and data-keyboard to false may solve your problem.

Please have a look here.It will give you solution

like image 179
Avinash Babu Avatar answered Oct 23 '22 03:10

Avinash Babu