当body标签有类rtl时,我尝试用iquery提醒消息。我写了这段代码:
if ($('#Body')).hasclass("rtl"))) { alert("RRRRRRRR TTTTTTTTTTTTTT lllllllllllll");}
当我跑步时,这不起作用。
答案 0 :(得分:1)
您需要使用标记选择器,而不是ID选择器
$('body').hasClass("rtl")
然后你的代码就像,
if ($('body').hasClass("rtl")) {
alert("RRRRRRRR TTTTTTTTTTTTTT lllllllllllll");
}
答案 1 :(得分:1)
您的括号不匹配,以及选择错误。您可以通过直接引用选择器 webView.setWebViewClient(new WebViewClient() {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
handler = new Handler();
runnable = new Runnable() {
@Override
public void run() {
if ((webView != null)) {
// Draw the page into a bitmap
webView.draw();
// After the bitmap is fully drawn, save the image
webView.saveImage();
// Finish the helper activity
finish();
}
}
};
handler.postDelayed(runnable, 2000);
}
});
中的元素来选择正文,而不需要使用id。
$('body')
答案 2 :(得分:0)
尝试以下代码:
<script>
$(document).ready(function(){
if ($("#body").hasClass("rtl"))
{
alert("RRRRRRRR TTTTTTTTTTTTTT lllllllllllll")
}
});
</script>