【问题标题】:Manipulating <p> text depending on country根据国家/地区操作 <p> 文本
【发布时间】:2015-03-16 07:23:57
【问题描述】:

我想换个

文本取决于国家/地区,这是我的代码不起作用:

jQuery(document).ready(function($) {
    country = geoplugin_countryName();
    if (country === "Russia") {
        $("p").text("blabla")   
    });

编辑:编辑为 $("p").text("blabla")。现在我得到Uncaught ReferenceError: geoplugin_countryName is not defined

有什么线索吗? :)

【问题讨论】:

  • 什么是 geoplugin_countryName()?
  • 它的javascript函数,基于这个插件:geoplugin.com/webservices/javascript
  • 你在代码中引用了那个js吗?
  • 不具体,但代码在外部“jquery.js”文件中

标签: jquery geolocation


【解决方案1】:

应该是

$("p").text("blabla");

【讨论】:

    【解决方案2】:

    使用这个:

    $("p").html("blabla");
    

    【讨论】:

      【解决方案3】:

      用于将 html 附加为:

      $("p").html("blabla");
      

      并比较为

      $("p").html() === "blabla"   
      

      【讨论】:

        猜你喜欢
        • 2020-02-27
        • 1970-01-01
        • 1970-01-01
        • 2015-05-10
        • 1970-01-01
        • 2019-04-15
        • 1970-01-01
        • 2013-08-18
        • 2018-07-06
        相关资源
        最近更新 更多