I get $("modal").openModal is not a function after your release 0.97.8
openModal, open and modal properties are undefined.
It works OK in 0.97.7
@alerd Can you provide a codepen please with the exact problem?
Codepen template
It's changed. Read the documentation for the modal again and try this: '$('.modal').modal('open');'
@alerd I think I know what your problem is. Just change this:
$(document).ready(function() {
$('.modal-trigger').leanModal();
});
into this:
$(document).ready(function() {
$('.modal').modal();
});
@tomscholz even i tried
$('.modal').modal();
modal is not working at all
Shouldn't these types of breaking changes be reserved for minor version releases as opposed to patch releases?
The modal plugin has been rewritten. You can read about it at the modals page
@acburst Can you address the issue that these are breaking changes included in a patch release?
Why would a patch release make such a breaking change? This should have been a minor version bump. Patches fix issues, not change implementation. Please revert this change.
lol
totally agree with the breaking change in a patch release issue; plus weak documentation. I missed this issue because it was closed, so opened one for the same problem(solution included):
https://github.com/Dogfalo/materialize/issues/3850
Also, unless I'm doing something wrong, $('#acme').modal('open') does not have the same behavior as $('#acme').openModal() had. The former animates the modal opening but doesn't apply opacity and doesn't catch closing the modal when clicking outside of it.
hmm, I think .modal('open') is working the same as .openModal() was, for me.
Please don't make breaking changes in patch releases like this
Doh this stuffed us up too!
Materialize was be updated, also you have update the new version of the official page and ready
If anyone is having the same problem as @jon-heller the issue is shows up if you have an older materialize.css and a newer materialize.js so just update your .css to match the version of your .js
Is 0.97.6 also affected?
Para arquivo externo funcionou comigo dessa forma, como no comentario do zanozik nesse artigo.
https://github.com/Dogfalo/materialize/issues/3850
$(#btn).on('click', function(){
$(#modal1).modal(); //chama a fun莽茫o
$(#modal1).modal('open'); //atribui uma a莽茫o open/close...
});
Para o mesmo arquivo index.php .. etc.. esse link funciona bem https://codepen.io/anon/pen/ZBzYwB
The error persist , I'm using Materialize v3.1.
$(document).ready(function(){
... some code
});
function OpenModal() { // click a button
$('#IdModal').modal('open'); // Error ($(....) Modal is not a function)
}
You must use the function openModal() to make it work.
$(document).ready(function(){
... some code
});
function OpenModal() { // click a button
$('#IdModal').openModal(); // Ok
}
Update your java script files of JQuery and MaterializeCSS to latest lib from http://materializecss.com/getting-started.html
<!--Import jQuery before materialize.js-->
<script type="text/javascript" src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<!-- Compiled and minified JavaScript -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.100.2/js/materialize.min.js"></script></script>
Codepen example:
Most helpful comment
Why would a patch release make such a breaking change? This should have been a minor version bump. Patches fix issues, not change implementation. Please revert this change.