我正在使用http://rvera.github.io/image-picker/中的图片选择器,我想在页面加载期间预选图像。我试过这个:
$('#image_picker option[value="54fdada12476"]').prop('selected',true);
$("#image_picker").imagepicker(...
但是不起作用。还尝试了选择图像选择器和jquery attr()的选项。是否有一种简单的方法来选择价值?
此致
答案 0 :(得分:1)
好的,明白了:
$("#image_picker").find('option[value="54fdada12476"]').prop('selected',true);
这会选择所需的选项
答案 1 :(得分:0)
and add
$("#image_picker").imagepicker();
after $("#image_picker").find('option[value="54fdada12476"]').prop('selected',true);
to reinitilize the picker