var myModal = document.getElementById('myModal'); // we need a blank modal to fill up and target our object function myModal.addEventListener('show.bs.modal', function(e) { console.log('show.bs.modal triggered for #'+e.target.id); console.log('event.relatedTarget is '+e.relatedTarget.tagName+'.'+e.relatedTarget.className.replace(/\s/g,'.')); }, false); // Modal initialized with JavaScript var myModalJS = document.getElementById('myModalJS'); // we need a blank modal to fill up and target our object function var btnModal = document.getElementById('openModalViaJS'); var firstModalContent = '
This is a damn awesome modal content template configured via Javascript, using the specific modal events like show.bs.modal
, so please open your console and check the log entries.
show.bs.modal
, so please open your console and check the logs. This is also a variable here, efficiently unleash cross-media information without cross-media value. Quickly maximize timely deliverables for real-time schemas. Dramatically maintain clicks-and-mortar solutions without functional solutions.',
};
// set new content for the modal and show it
btnModal2.addEventListener('click', function() {
//template content for modal example 2
modalInitJS.setContent(''+externalModalContent.content+'
' +'OK now this is a different content.
'; modalUpdateInit.update(); } }, false); // Dropdown init via JS var makeMeDropdown = document.getElementById('makeMeDropdown'); var myDropdownTemplate = 'Javascript isn\'t fun? Well, think again.
'; successAlert.innerHTML += 'I just didn\'t want this section to be empty, looks awful..
'; dangerAlert.parentNode.insertBefore(successAlert,siblings[siblings.length-2]); if (successAlert.classList) { successAlert.classList.add('in'); } else { successAlert.className += ' in'; } }); // NEW Alert events document.getElementById('alertDemo').addEventListener('close.bs.alert', function(e) { console.log( 'The "close.bs.alert" event fired for #' + e.target.id ); }); document.getElementById('alertDemo').addEventListener('closed.bs.alert', function(e) { console.log( 'The "closed.bs.alert" event fired for #' + e.target.id ); }); //demo popover. trigger via click var popover1 = new Popover('#popover-via-click', { trigger: 'click'} ); // demo popover, using template var someTitleFromOtherCode = 'Popover via JavaScript FOCUS'; var someContentFromOuterSpace = 'Some sample message from outer space wrapped in <p> tags. You can add your own functions to combine with Popover template as you wish.
'; var popover2 = new Popover('.popover-via-template', { trigger: 'focus', template: '