Issue
<a href="#" class="image-swatch no-lightbox" data-value="red-1" </span>">
<a href="#" class="image-swatch no-lightbox" data-value="green-2" </span>">
i tried to add this but didn't work with a href
$(document).ready(function(){
$('.image-swatch').prop('selectedIndex', 1);
});
image swatch is plugin for wordpress and have no selected by default option and my only way to do so by adding jquery so how i can select red by default using jQuery im not good when its come to coding thanks for your help
Solution
Try this, just change the index in $colores[0], 0 is equal to the first element 1 the second and so on
jQuery(document).ready(function($){
$colores = $('.image-swatch');
$($colores[0]).addClass('selected');
});
Answered By - Jairo Py Answer Checked By - Mary Flores (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.