Onclick Expand Textbox Width

后端 未结 6 669
滥情空心
滥情空心 2020-12-30 06:39

I want to use jQuery to expand the width of a input textbox during onclick.

For example, if the input has a default width of 100px, when the user clicks in it to ty

6条回答
  •  隐瞒了意图╮
    2020-12-30 07:02

    I know this is a bit late to the party, but if anyone wants a pure CSS solution that uses the :focus attribute.

    #textbox {
      width:100px;
      transition: 0.5s;
    }
    
    #textbox:focus {
      width:150px;
      transition: 0.5s;
    }
    

    He's my jsFiddle:

    https://jsfiddle.net/qo95uquv/

    Tom

提交回复
热议问题