question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

does not work initialization modal

See original GitHub issue
<div id="data_modal" class="modal"> 
	<div class="modal-content"> 
		<h4>Modal Header</h4> 
		<div class="row">
			<div class="col l12">
				A bunch of text 
			</div>
		</div>
	</div> 
	<div class="modal-footer"> 
		<a href="#!" class="modal-action modal-close waves-effect waves-green btn-flat" id="save_frame">Сохранить</a> 
	</div> 
</div>
<script type="text/javascript">
	// заполняем и открываем модалочку
	function _show_data_modal(_in){
		var _elem = $('#data_modal');
		var modal = M.Modal.getInstance(_elem);
		// _elem.children('.modal-content').html('<h4>' + _in['title'] + '</h4>')
		_elem.children('.modal-content').html(_in['content']);
		modal.open();
	}
</script>

===error

Uncaught TypeError: Cannot read property ‘open’ of undefined at _show_data_modal (lm=doc_edit&did=1:183) at eval (eval at success (scripts.js?v1522782874:20), <anonymous>:1:1) at Object.success (scripts.js?v1522782874:20) at i (jquery-3.2.1.min.js:2) at Object.fireWith [as resolveWith] (jquery-3.2.1.min.js:2) at A (jquery-3.2.1.min.js:4) at XMLHttpRequest.<anonymous> (jquery-3.2.1.min.js:4)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
Dogfalocommented, Apr 7, 2018
1reaction
dgzraulcommented, Nov 12, 2018

You can use this

Get element by ID var elems = document.getElementById('idDivModal');

The next method is OPTIONAL

With this method you can reconfigure your DIV MODAL and you can add more options

var instances = M.Modal.init(elems, { 
   opacity: 0.5
});

New instance var instance = M.Modal.getInstance(elems); instance.open(); // instance with methods

Read more comments on GitHub >

github_iconTop Results From Across the Web

bootstrap modal not working at all - Stack Overflow
Before posting my complete solution i would like to know , have you initialized your modal before loading it. Initialization:- $(function(){ ...
Read more >
Why can't DataTable get initialized properly in modal dialog
I am working on an application built in ASP.NET Core MVC and It has few modal popups displayed with datatables inside.
Read more >
Bootstrap JS Modal Reference - W3Schools
The Modal plugin is a dialog box/popup window that is displayed on top of the current page. For a tutorial about Modals, read...
Read more >
Problem with dynamic input fields labels initialization insi
I have a problem with dynamic input fields labels initialization inside a modal form loaded by ajax. I have tried to initialize the...
Read more >
Dialog Widget | jQuery UI API Documentation
Modal dialogs additionally prevent mouse users from clicking on elements ... Note: The appendTo option should not be changed while the dialog is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found