1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Remove last character from a HTML label?

Discussion in 'Off Topic' started by Mouth, May 1, 2016.

  1. Mouth

    Mouth Well-Known Member

    Hopefully XF guru's can help me with a non-XF problem needing a solution?

    Given the following HTML code snippet, that I'm unable to edit;
    <tr><td class="MBD-Space3" colspan="2">&nbsp;</td></tr>   
                   <td style="text-align:right;vertical-align:middle;width:40%;white-space:nowrap;" class="MBD-MediumTextBold" >
                      <Label For="MAIL">E-Mail:</Label> <span class="MBD-RedAsterisk">*</span>&nbsp;                                                     
                   <td style="text-align:left;vertical-align:top;white-space:nowrap;">
                      <input type="text" class="MBD-MediumText" id="MAIL" name="MAIL" value="" maxlength="150" size="40">
                      <input type="hidden" name="MAIL_RECKEY" value="0">                     
    How could I use javascript or CSS so that the colon in the label text is removed? "E-Mail:" becomes "E-Mail".
  2. Arty

    Arty Well-Known Member

    JS solution:
    $(document).ready(function() { $('label[for="MAIL"]').each(function() { var $this = $(this); $this.html($this.html().replace(':', '')); }); });
    Mouth, rafass and Steve F like this.
  3. Mouth

    Mouth Well-Known Member

    Thank-you very much :)

Share This Page