我試圖從jQuery if
語句的span類中獲取TEXT。舉例來說,如果我有這樣的:jQuery爲jQuery'IF'語句獲取文本
if ($('input:radio[name=SELECT___ENG___57]:checked').val() == '1191') {
$("[class^=eng_]").css("display", "none");}
我想在input:radio[name=SELECT___ENG___57]:checked
的「ENG」從<span class="product_code">ENG</span>
(在同一頁面上的其他地方)動態值
所以基本上如果<span class="product_code">IMANOOB</span>
我將如何獲得我的jQuery是
if ($('input:radio[name=SELECT___IMANOOB___57]:checked').val() == '1191') {
$("[class^=eng_]").css("display", "none");}
在此先感謝!
您與選擇搞亂了那裏,只是使用像$僞選擇器( '跨度:包含( 「someValue中」)') – sarepta 2014-09-21 21:08:24
你能發佈你的HTML的代表性樣本嗎?這可能比你的解釋更能說明你的問題(儘管如此,請嘗試並改進解釋)。如果可以,請在您的問題中加入現場演示(請參閱:http://blog.stackoverflow.com/2014/09/introducing-runnable-javascript-css-and-html-code-snippets/?cb=1 )。 – 2014-09-21 21:19:00