Would this be a solution? – JavaScript – SitePoint Forums

[ad_1]

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()
}

..

[ad_2]

Read More

About the author

Would this be a solution? – JavaScript – SitePoint Forums – webhostingreviewsite.com