Search
 
SCRIPT & CODE EXAMPLE
 

HTML

bootstrap modal popup disable click outside

 <button data-target="#myModal" data-toggle="modal" data-backdrop="static" data-keyboard="false">
    Launch demo modal
 </button>
Comment

bootstrap modal popup disable click outside

$('#myModal').modal({backdrop: 'static', keyboard: false})  
Comment

prevent bootstrap modal from closing when clicking outside

<div id="idModal" class="modal hide" data-backdrop="static" data-keyboard="false">
Comment

prevent close modal when click outside

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

or in HTML
<a data-controls-modal="your_div_id" data-backdrop="static" data-keyboard="false" href="#">
Comment

html close modal when click outside

<body>
  <div class="modal fade" id="modalID" tabindex="-1" data-bs-backdrop="true" style="border-radius:38px;">
    <div class="modal-dialog">
      <div class="modal-content">
	        Lorem ipsum ....
      </div>
    </div>
  </div>
</body>

<script>
  // Bootstrap 5
  let modal = new bootstrap.Modal( document.querySelector('#emailValidation'), { backdrop: true, keyboard: true } );
  modal.toggle();
</script>
Comment

prevent modal from auto closing when clicked away

<!-- Button trigger modal -->
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop">
  Launch static backdrop modal
</button>

<!-- Modal -->
<div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="staticBackdropLabel">Modal title</h5>
        <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Understood</button>
      </div>
    </div>
  </div>
</div>
Comment

prevent close modal when click outside

<div class="modal fade" id="myModal" data-keyboard="false" data-backdrop="static">
Comment

Stop modal from closing on outside click

Set the modal's backdrop to static. The modal component has a prop of backdrop, set that to backdrop="static"

<div>
    <Modal show={this.state.show} onHide={this.handleClose} backdrop="static">
        <Modal.Header>
            <Modal.Title>Change Password</Modal.Title>
        </Modal.Header>
        <Modal.Body>
            <form className="form-horizontal" style={{margin:0}}>
                <div className='password-heading'>This is the first time you have logged in.</div>
                <div className='password-heading'>Please set a new password for your account.</div>
                <br/>

                <label className="password">Password
                    <input type={this.state.type} className="password__input" onChange={this.passwordStrength}/>
                    <span className="password__show" onClick={this.showHide}>{this.state.type === 'input' ? 'Hide' : 'Show'}</span>
                    <span className="password__strength" data-score={this.state.score}>
                        <div className="strength_string">{this.state.strength}</div>
                    </span>
                </label>
                <br/>
                <label className="password">Confirm Password
                    <input type={this.state.type} className="password__input" onChange={this.passwordStrength}/>
                </label>

            </form>
            <br/>
        </Modal.Body>
        <Modal.Footer>
            <Button onClick={this.submitPassword} disabled={this.state.isDisabled}>Submit</Button>
        </Modal.Footer>
    </Modal>
</div>
Comment

PREVIOUS NEXT
Code Example
Html :: how to add an svg image to html 
Html :: how to add .java files to html 
Html :: insertar playlist youtube html5 
Html :: table bootstrap with scrool 
Html :: nuclear bomb 
Html :: html clickable image 
Html :: color de las letras en html 
Html :: multiline input 
Html :: start a video at a certain time and end time html 
Html :: change html div jquery 
Html :: html percentage 
Html :: relative path 
Html :: what should i use for html 
Html :: px in server is different from html file 
Html :: eslint ignore v-html 
Html :: js download html 
Html :: html select change event 
Html :: opening tag closing tag 
Html :: onchange html 
Html :: cnic pattern on input 
Html :: input field with add button that creates another input 
Html :: remove reset all css using style property attribute in react component 
Html :: html input for email 
Html :: svelte pass arguments to function 
Html :: style upload button vue 
Html :: change the font-size on a label css 
Html :: nav bar activate in jinja 
Html :: menu hamburguer html 
Html :: input hidden selected 
Html :: html footer 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =