I have the following code:
this.urlSet = function(){
    $("#url").keyup(function(){
  开发者_JAVA百科      $("#firstpath").val() = $("#url").val().substring(0,8);
        $("#secndpath").val() = $("#url").val().substring(0,8);
        $("#thirdpath").val() = $("#url").val().substring(0,8);
    });
};
I'm trying to get the three textboxes named "xxxpath" to fill with the first 8 characters of the url textbox as the user is typing. However, with the code in this state, nothing happens. Anyone have a quick idea where I'm going wrong?
Thanks!
You need to use val(value_to_set) function, because val() it's only to get the value:
this.urlSet = function(){
    $("#url").keyup(function(){
        $("#firstpath").val($("#url").val().substring(0,8));
        $("#secndpath").val($("#url").val().substring(0,8));
        $("#thirdpath").val($("#url").val().substring(0,8));
    });
};
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论