开发者

How to change selected item in dropdown via clicking on an image (jquery)

I am using magento, but am far from jquery/javascript

I have a list of images that i want to be able to click and change the corresponding dropdown list selection.

I can have it set up so that select name/value or option value can be attached to each image that 开发者_JAVA百科corresponds either using class or id. So i just need the basic jquery to input

thanks a million


Say the id of the image is the value of the dropdown item.

$('img').click(function() { 
    $('#dropdown').val($(this).attr('id'));
});

JsFiddle Example

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜