0

The label text of a checkbox is dynamically generated in CodeCharge. The label text includes the amount of available articles. When this number is (0), the checkbox and the label text should be hidden, if not both checkbox and label value must be shown.

In this case checkbox and label text hidden:

<input id="i_search_2_newdatad9_1" name="d9[]" value="standplaatsreis" type="checkbox"  /><label for="i_search_2_newdatad9_1">Standplaatsreis (0)</label>

In this case checkbox and label visible:

<input id="i_search_2_newdatad9_1" name="d9[]" value="standplaatsreis" type="checkbox"  /><label for="i_search_2_newdatad9_1">Standplaatsreis (8)</label>

I appreciate your suggestions for a php or jquery script.

2 Answers 2

2

A jQuery solution:

$('label:contains("(0)")').each(function() {
    $('#' + $(this).attr('for')).hide();
    $(this).hide();
});
Sign up to request clarification or add additional context in comments.

Comments

0

Since you mention jQuery in your question:

$(function() {
   $('input').filter(function() { return $(this).next('label').text().substr(-3) == '(0)'; }).hide().next('label').hide();
   });
});

A PHP solution would be better, but without any code, we cannot help you.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.