I want to check the div whose class name is swatch-option and which is coming dynamically and there is not only single div with this class there is a lot of div with the same class now I want to check that if one of these div is disable and also click on that div then it shows me a message. let me inform you That I want to do this in javascript not in Jquery. the code I tried is
<script type="text/javascript">
var e = document.getElementsByClassName("swatch-option");
e.onClick = MyFunction;
function MyFunction()
{
if (e.disabled == true) {
alert('working');
}else{
alert('not Working');
}
}
</script>
I also tried
<script type="text/javascript">
window.onload = function() {
var e = document.getElementsByClassName("disabled");
e.onClick = function MyFunction()
{
if (e.disabled == true) {
alert('Working');
}else{
alert('not Working');
}
}
}
</script>
but still not working
the circle I made around the colors is disabled so when I clicked on these colors then it shows a message out of Stock