I've designed a Bootstrap 5 button to control the motor:
<button id=button_90 onclick="return motor_turn(512)" class="btn btn-primary" type="button">90</button>
Clicking the button highlights it in blue, and successfully turns the motor. Here's the code for my on-click function:
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
};
After the motor operation is completed, I'm trying to remove the highlight from the button. I've attempted using 'blur' and 'toggle', but with no luck. As someone new to JS and UI programming, I would appreciate any guidance on this matter.