Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the value form Materialize's Switches?

I'm using the Materialize library and I'm trying to retrieve the value from the switches component, but it always returns on regardless of it being turned on or off.

Is there a way to determine if it's switched on or off, programatically?

like image 420
Tomas Romero Avatar asked Feb 28 '15 02:02

Tomas Romero


1 Answers

You have to use .checked For example: Javascript:

document.getElementById('mySwitch').checked

JQuery:

$('#mySwitch').prop('checked')

I hope that I help you.

like image 152
Kamil Łukaszewicz Avatar answered Oct 21 '22 06:10

Kamil Łukaszewicz