简体   繁体   English

当输入字段长度 * 8 大于 360 时,获取输入值长度并在输入字段后添加 3 个点

[英]Get input value lenght and add 3 dots after input field when input fields lenght * 8 is bigger than 360

I wrote a code for adding 3 dots (...) when input field's value is too long.当输入字段的值太长时,我编写了一个添加 3 个点 (...) 的代码。 But It didn't work (I checked.after("...") its works)但它没有用(我检查了.after(“...”)它的作品)

If the number of letters times 8 is greater than 350, 3 dots must be added如果字母数乘以 8 大于 350,则必须加 3 个点

var degisinput = document.querySelector(".degistirilebilirinput").value;
if(degisinput.lenght * 8 > 350)
{
  $(".bloklink .degistirilebilirinput").after("...");
}

Take first strings (input values are always string when u reach them) then take first 3 chars from it and add three dots while doing that they are inside of val() function.获取第一个字符串(当您到达它们时,输入值始终是字符串)然后从中获取前 3 个字符并添加三个点,同时它们位于 val() function 内部。

var degisinput = document.querySelector(".degistirilebilirinput").value;
    if(degisinput.lenght * 8 > 350)
    {
      $(".bloklink .degistirilebilirinput").val(
        Number($(".bloklink .degistirilebilirinput")
        .val().slice(3))+'...'

       )
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM