从翻译datepicker停止谷歌翻译

Luk*_*nke 0 jquery jquery-ui datepicker google-translate

http://jsfiddle.net/tkRaQ/51/

这里的"addClass":$(".datepicker").datepicker().addClass('notranslate'); 不解决它....(谷歌翻译停止选择工作日期)

出于某种原因,其他代码修复了它:

$("#fix").click(function() {
    $('.ui-datepicker').addClass('notranslate');
});
Run Code Online (Sandbox Code Playgroud)

有没有办法在没有#fix.click的情况下停止翻译?

jcs*_*nyi 11

Your first line is adding the notranslate class to the input element that you're triggering the datepicker from.

The datepicker UI elements are different from the input field, and get created automatically at the end of the document. You can find them with the jqueryui class ui-datepicker (which you're already doing). However, they get created as soon as you configure the datepicker on your input field, so you can immediately follow your first line with a line that finds the automatically-created ui elements and adds the notranslate class to them (instead of putting it on a button click)

$(function() {
    $(".datepicker").datepicker();
    $('.ui-datepicker').addClass('notranslate');
});
Run Code Online (Sandbox Code Playgroud)

Working fiddle is here: http://jsfiddle.net/J5buS/3/