隐藏标签

时间:2017-03-26 17:03:41

标签: html css

我正在与wordpress插件挣扎,而我试图隐藏(甚至取代那将是非常棒的)单词" DD"," MM&#34 ;和" YYYY"在以下代码中:

<div class="smFormInlineFormCont">
    <div class="smInlineForm smInlineFormDate">
        <span>
        <label><input name="smFieldData[wpformfield5627][date][dd]" id="smform-field-yyyy2452" 
            value=""
            class="smFieldDD smform-control smform-field-sizelarge "
            type="number"  date-type="date"  min="1" max="31" /> DD</label></span>

        <span><label><input name="smFieldData[wpformfield5627][date][mm]" id="smform-field-mm2452" 
            value=""
            class="smFieldMM smform-control smform-field-sizelarge "
            type="number"  date-type="date"  min="1" max="12" /> MM</label></span>

        <span><label><input name="smFieldData[wpformfield5627][date][yyyy]" id="smform-field-yyyy2452" 
            value=""
            class="smFieldDD smform-control smform-field-sizelarge "
            type="number"  date-type="date" min="1" max="9999" /> YYYY</label></span>
    </div>

问题是我正在用法语建立一个网站,所以我宁愿把JJ,MM,AAAA放在一起,或者只是简单地删除那些困扰我的字母。

感谢您的帮助:)

1 个答案:

答案 0 :(得分:0)

使用javascript或jquery替换所需的文本:

$(document).ready(function(){
   $('label').each(function(){
     var txt = $(this).text().replace("YYYY", "AAAA").replace("DD", "JJ");
     var inp = $(this).find('input');
     $(this).html('');
     $(this).append(inp);
     $(this).append(txt);
   });
 });
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>

<div class="smFormInlineFormCont">
    <div class="smInlineForm smInlineFormDate">
        <span>
        <label><input name="smFieldData[wpformfield5627][date][dd]" id="smform-field-yyyy2452" 
            value=""
            class="smFieldDD smform-control smform-field-sizelarge "
            type="number"  date-type="date"  min="1" max="31" /> DD</label></span>

        <span><label><input name="smFieldData[wpformfield5627][date][mm]" id="smform-field-mm2452" 
            value=""
            class="smFieldMM smform-control smform-field-sizelarge "
            type="number"  date-type="date"  min="1" max="12" /> MM</label></span>

        <span><label><input name="smFieldData[wpformfield5627][date][yyyy]" id="smform-field-yyyy2452" 
            value=""
            class="smFieldDD smform-control smform-field-sizelarge "
            type="number"  date-type="date" min="1" max="9999" /> YYYY</label></span>
    </div>