cuốn sách gpt4 ai đã làm

javascript - 当
包含特定字符或单个字符时隐藏

In lại Tác giả: Walker 123 更新时间:2023-11-28 15:51:07 30 4
mua khóa gpt4 Nike

我有 HTML 显示用户对私有(private)用户配置文件页面上表单中的字段的响应。表单上的字段是有条件的,因此其中许多字段永远不会呈现给用户。 HTML 由系统输出,从未呈现给用户的下拉字段会收到“—”(破折号?)作为值,而他们未选中的复选框会收到“否”。

系统缺少识别和隐藏这些字段的功能,因此我必须使用 CSS 或 JS/JQ 来完成。准备好文档后,我需要隐藏具有“—”值的 DD 和关联的父 DT。我还想通过显示为“否”的复选框来执行此操作,但破折号更为重要。

我在尝试调整类似帖子中提供的解决方案时没有取得任何成功。感谢您提供任何建议和专业知识!

 

Test Account submitted this request


Status

<đ>

Open



Name

<đ>
Wayne Gretzky


Order Number

<đ>



Brand

<đ>
Brand XYZ


Check the box if you are trying to retrieve links or registration information.

<đ>
No


Check the box if you can access the email address your software is registered to.

<đ>
No


SS Product Type

<đ>
Plus


SN Product Type

<đ>



SNE Product Type

<đ>



TLE Product Type

<đ>

câu trả lời hay nhất

你可以遍历spans,如果它们的任何内容是,那么隐藏父级dd和之前的dt

$('span').each(function() {
if ($(this).text() == '—') {
$(this).parent('dd').addClass('hidden').prev('dt').addClass('hidden');
}
});



.ẩn giấu {
hiển thị: không có;
}



Test Account submitted this request


Status

<đ>

Open



Name

<đ>
Wayne Gretzky


Order Number

<đ>



Brand

<đ>
Brand XYZ


Check the box if you are trying to retrieve links or registration information.

<đ>
No


Check the box if you can access the email address your software is registered to.

<đ>
No


SS Product Type

<đ>
Plus


SN Product Type (hide)

<đ>



SNE Product Type

<đ>



TLE Product Type

<đ>

关于javascript - 当

包含特定字符或单个字符时隐藏
,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41862826/

30 4 0
Walker 123
Hồ sơ

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá taxi Didi miễn phí
Phiếu giảm giá taxi Didi
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress