【问题标题】:html How to show last character in limit width textboxhtml如何在限制宽度文本框中显示最后一个字符
【发布时间】:2016-10-21 12:40:43
【问题描述】:

我想在文本框中显示为“/11/02”,但现在显示为“2016/”

.date {
        width: 40px;
        text-align: justify;
        text-align-last: end;
    }

<input id="date" name="date" class="date" tabindex="-1" readonly="readonly" type="text" value="2016/11/02">

capture textbox with width 40px

【问题讨论】:

    标签: html textbox text-align


    【解决方案1】:

    您可以为此使用 jquery。

    <script>
        var date = $(".date").val();
        var last = date.substr(date.length - 6); 
        $(".date").val(last);
    </script>
    

    【讨论】:

      猜你喜欢
      • 2018-04-27
      • 1970-01-01
      • 1970-01-01
      • 2010-12-28
      • 2013-12-20
      • 1970-01-01
      • 1970-01-01
      • 2012-03-14
      • 1970-01-01
      相关资源
      最近更新 更多