我正在使用以下代碼。第一個if
條件正在工作,但第二個if
不是。我不知道爲什麼?同樣的CSS也應該應用於第二個if
。誰能告訴我爲什麼這是?在jquery中使用css
<script type="text/javascript">
if (location.pathname.indexOf("girl-clothing") != -1) {
$(".RetailPriceValue").css("cssText", "margin: -203px 0 0 0 !important;");
}
if (location.pathname.indexOf("http://www.xyz.com/girl-clothing/?sort=featured&page=2")!= -1) {
$(".RetailPriceValue").css("cssText", "margin:-220px 0 0 0 !important;");
}
</script>
那是什麼 'cssText' 屬性的名字嗎? –
indexOf的轉義序列? –