2
As you can see in the example below, I have a Collapsible and in the initial structure I have a button/link (example + sign), I would like to be able to press this button and not activate the function that expands Collapsible
https://jsfiddle.net/d5th7o6r/7/
$('.collapsible').collapsible();
function fazalgo () {
console.log(":)");
}
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/css/materialize.min.css">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0-rc.2/js/materialize.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<ul class="collapsible">
<li>
<div class="collapsible-header"><i class="material-icons">filter_drama</i>First
<a onclick='fazalgo()' class="secondary-content"><i class="material-icons">add</i></a>
</div>
<div class="collapsible-body"><span>Lorem ipsum dolor sit amet.</span></div>
</li>
<li>
<div class="collapsible-header"><i class="material-icons">place</i>Second
<a onclick='fazalgo()' class="secondary-content"><i class="material-icons">add</i></a>
</div>
<div class="collapsible-body"><span>Lorem ipsum dolor sit amet.</span></div>
</li>
<li>
<div class="collapsible-header"><i class="material-icons">whatshot</i>Third
<a class="secondary-content"><i class="material-icons">add</i></a>
</div>
<div class="collapsible-body"><span>Lorem ipsum dolor sit amet.</span></div>
</li>
</ul>
If it’s not to expand Collapse when you press + what do you want it to perform when you click +? Your question is confused... You want each + to just expand and collect its own content, not that by clicking on one it expands and the other collection is this?
– hugocsl
no, in case the + button triggers another function, q in my problem would be to add the item in a shopping bag. (I will try to fix the code)
– kcvventura
Dude then why use the Collapse component for that? Or you want to have Collapse, but you want btn + to not open Collapse and do something else?
– hugocsl
that, I want the button to call a different function, it will run it and not open Collapse, but the rest of the field will still open the same
– kcvventura
How so the rest of the field will still open the same? You want the button to open the Collapse yes or no?
– LeAndrade