Another noob question. Help w/ javascript and a button closing a card


#1

I wanna know how to make the button at the bottom of a card dismiss (or close) the card. I know no javascript (so fkn confusing for me).

Thanks so much!!

-CJ


#2

There are a couple of different ways doing this.

  1. You can use collapse function to hide the card. You can visit this page http://daemonite.github.io/material/ui-collapse.html for more information about collapse.

  2. You can set the card to be display: none; when the button is .on('click', function(){...}) or onclick="...". For example: http://www.w3schools.com/jsref/event_onclick.asp.


#3

Alright thanks. Only issue is I want the card to start out expanded then when I click Hide I want it to hide. When you go to the page at first, it shows Show but the card is expanded. PLEASE HELP!! I’m SO FREAKING CONFUSED. Thanks!!

Here’s the page (it’s the first card)
http://www.cjchico.com/wip/wip.html

This is my code for that card: http://hastebin.com/wowalemowo.xml


#4

this is because the default status of the card is not set to collapse. to fix this, you just need to add class collapse on collapsible-region.