I have created a on-off button with the following code. Now I want to make it switch from on to off when a value is read I am using these options: $('#red').attr('checked','checked'); to check it and uncheck it $('#red').removeAttr('checked'); but nothing changes.Have you got any ideas?
Hi,I have a project that I have made a web application that shows some buttons which interact with the client and accordingly to the values of the buttons, it makes changes on the server such as: if you turn on a button on the site, on the server you can see a led on...and so on.What I want to do now is upon a value (that is displayed as well on the site) put the button off and keep it there for secure reasons lets say...the code for the buttons is above
"<script>"
"$(document).ready(function(){ $('#red').bind( 'change', function(event, ui) { jQuery.ajaxSetup({timeout: 1000}); var id = $(this).attr('id'); var strength = $(this).val(); if (id == 'red') $.post('/remote', { red: strength } ); });});"