jQuery Textarea focus

后端 未结 3 2003
青春惊慌失措
青春惊慌失措 2021-01-07 17:43

When I click a button I want the textarea in this li element to focus.

  • 3条回答
    •  攒了一身酷
      2021-01-07 18:14

      Based on your comment in reply to Jacob, perhaps you want:

      $('.user-status-buttons').click(function(){
      
          var id = $(this).attr('id');
          $("#commentbox-"+id).slideToggle("fast", function(){
              $("#commentbox-"+id+" #StatusMessageReplyMessage").focus();
          });
      
          return false;
      });
      

      This should give the #StatusMessageReplyMessage element focus after the slide effect has finished.

    提交回复
    热议问题