停止Google翻译翻译日期戳 [英] Stopping google translate from translating datepicker

查看:231
本文介绍了停止Google翻译翻译日期戳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

The "addClass" here: $(".datepicker").datepicker().addClass('notranslate'); doesn't fix it.... (google translation stops the selection of dates from working)

由于某些原因,其他代码修复它:点击(function(){
$('。ui-datepicker'),然后点击($($($)

For some reason the other code fixes it:

$("#fix").click(function() {
    $('.ui-datepicker').addClass('notranslate');
});

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

Is there a way of stopping the translation without #fix.click?

推荐答案

您的第一行将 notranslate 类添加到您触发datepicker的输入元素from。

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

datepicker UI元素与输入字段不同,并在文档末尾自动创建。您可以使用jqueryui类 ui-datepicker (您已经在做的)找到它们。但是,一旦您在输入字段中配置datepicker,就会立即创建它们,因此您可以立即使用一行找到自动创建的ui元素的行来跟踪第一行,并向它们添加notranslate类(而不是将其放在一个按钮单击)

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');
});

工作小提琴在这里: http://jsfiddle.net/J5buS/3/

这篇关于停止Google翻译翻译日期戳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆