I want to disable click on magento 2 color swatch but they are not working if one color is here i use this code in swatch-renderer.js file but they are not working
// Connect Tooltip
container
.find('[option-type="1"], [option-type="2"], [option-type="0"], [option-type="3"]')
.SwatchRendererTooltip();
// Hide all elements below more button
$('.' + classes.moreButton).nextAll().hide();
// Handle events like click or change
$widget._EventListener();
// Rewind options
$widget._Rewind(container);
//Emulate click on all swatches from Request
$widget._EmulateSelected($.parseQuery());
$widget._EmulateSelected($widget._getSelectedAttributes());
var swatchLength = $('.swatch-option.color').length; // if color attribute
if(swatchLength == 1){
if($('.swatch-attribute').hasClass("color")){
$('.swatch-option.color').first().click();
$('.swatch-option.color').prop('disabled',true)
}
}
},