I have created a button in Bootstrap 5 to turn a motor like this:
<button id=button_90 onclick="return motor_turn(512)" class="btn btn-primary" type="button">90</button>
When the button is clicked, a blue highlight around the button appears, and the function call turns the motor successfully. My on-click function code looks like this:
function motor_turn(steps){
$.get('/move_motor_ep',
{
'steps': steps,
'motorPinsXX': JSON.stringify(motorPins)
},
function(data, status){
//alert("Data: " + data + "\nStatus: " + status);
console.log("Move_motor status: " + status);
});
console.log("Toggling button back");
//$(button_90).toggle();
$('button_90').blur();
return false; //prevent auto-navigation to button URL
};
I am trying to return the button to the "un-pressed" state (without the blue highlight) upon completion of the motor turn operation. I have tried using 'blur' and 'toggle' without success.
I am very new to JS an UI programming...any help with this would be appreciated.