如果Div包含的数字比XX大,则JQuery显示元素

时间:2018-02-25 14:03:01

标签: jquery

使用jQuery,我只想在@Bean public ContactProvider contactProvider() { Preferences preferences = Preferences.userNodeForPackage(PhoneBook.class); String preferredProviderName = preferences.get(PreferenceKeys.CONTACT_PROVIDER.toString(), ContactProviders.FILE.getShortName()); try { Class<? extends ContactProvider> providerClass = ContactProviders.fromString(preferredProviderName) .getProviderClass(); Constructor<? extends ContactProvider> constructor = providerClass.getConstructor(); return constructor.newInstance(); } catch (IllegalArgumentException e) { logger.error("Can't get provider from given string: " + e.getMessage()); } catch (NoSuchMethodException e) { logger.error("Can't find provider's constructor: " + e.getMessage()); } catch (IllegalAccessException e) { logger.error("Can't get access to provider's constructor: " + e.getMessage()); } catch (InstantiationException e) { logger.error("Can instantiate provider: " + e.getMessage()); } catch (InvocationTargetException e) { logger.error("Can't invoke provider's constructor: " + e.getMessage()); } logger.info("Couldn't get provider from preferences. Default file contact provider instantiated."); return new FileContactProvider(); } 内的数字大于100时显示singlepostview

tptn_counter

我用:

<span class="singlepostview" title="Views">
<div class="tptn_counter" id="tptn_counter_6856">59</div>
</span>

我将CSS设置为:

if(jQuery(".tptn_counter").text() > 100 ) {
   jQuery(".singlepostview").show();
}

代码效果很好但是当我的逗号分隔符号为1,000(一千)时,.singlepostview { position: relative; display: none; cursor: pointer; float: right; line-height: 41px; height: 41px; margin: 0 40px 0 0; } 保持隐藏。怎么了?

感谢您的帮助。我真的很感激。

&#13;
&#13;
singlepostview
&#13;
 if(jQuery(".tptn_counter").text() > 100 ) {
       jQuery(".singlepostview").show();
    }
&#13;
.singlepostview {
        position: relative;
    	display: none;
    	cursor: pointer;
        float: right;
        line-height: 41px;
        height: 41px;
        margin: 0 40px 0 0;
    }
&#13;
&#13;
&#13;

0 个答案:

没有答案