[英]Hide Checkbox and Label based on Label text
復選框的標簽文本在CodeCharge中動態生成。 標簽文本包括可用文章的數量。 當此數字為(0)時,應隱藏復選框和標簽文本,否則必須同時顯示復選框和標簽值。
在這種情況下隱藏的復選框和標簽文本:
<input id="i_search_2_newdatad9_1" name="d9[]" value="standplaatsreis" type="checkbox" /><label for="i_search_2_newdatad9_1">Standplaatsreis (0)</label>
在這種情況下,復選框和標簽可見:
<input id="i_search_2_newdatad9_1" name="d9[]" value="standplaatsreis" type="checkbox" /><label for="i_search_2_newdatad9_1">Standplaatsreis (8)</label>
我感謝您對php或jquery腳本的建議。
一個jQuery解決方案:
$('label:contains("(0)")').each(function() {
$('#' + $(this).attr('for')).hide();
$(this).hide();
});
既然你在提問中提到了jQuery:
$(function() { $('input').filter(function() { return $(this).next('label').text().substr(-3) == '(0)'; }).hide().next('label').hide(); }); });
PHP解決方案會更好,但沒有任何代碼,我們無法幫助您。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.