Would this be a solution? – JavaScript – SitePoint Forums

Create A Website for $1.99/Month

I want to know if a slot in a rack is occupied.
I have a 40 slot rack.

This rack has a few slots being used.

If I try and place a device on a slot being used, I want the form NOT t be submitted and sent to a div called collision, but if no collision is found., allow the form to be submitted…

<form… onSubmit=”detectCollision(frontAssets)”>

</form>

// just have the function return true or false
function detectCollision(assets = []) {
const selectValue = document.getElementById(‘Beginning_ru’).value;

return assets.some((asset) => selectValue > asset[‘beginning_ru’])
}z

if (detectCollision(frontAssets)) {
document.getElementById(‘Collision’).scrollIntoView()
}

..

Read More

You May Also Like

About the Author: V. Moss