2013-07-01 45 views
0

我用這個梅託德改變CSS如何檢查李2個parametrs:包含

$("#AllProducts li:contains('" + Product + "')").css("background", "white"); 

能正常工作,但現在我需要檢查兩個parametrs當我chagne CSS有些人認爲這樣的

$("#AllProducts li:contains('" + Product + "')&&('" + iCategory + "') ").css("background", "white"); 
梅託德

但這不起作用。我無法檢查是否包含產品,並比如果iCategory我需要它們在同一個對象蜜蜂。

+0

Dublicate http://stackoverflow.com/questions/2416803/jquery-contains-selector-to-search-for-multiple-strings – iMBMT

回答

2

我覺得你在找東西like this。簡短的回答,試試這個:

$("#AllProducts li:contains('" + Product + "'):contains('" + iCategory + "') ") 
+0

100%我需要什麼!!! –

0

什麼:

$("#AllProducts li:contains('" + Product + "'):contains('" + iCategory + "')").css("background", "white");