Clear text field value in JQuery

前端 未结 15 1437
情书的邮戳
情书的邮戳 2020-12-05 12:26

I understand this is an easy question but for some reason this just isn\'t working for me. I have a function that is triggered everytime a drop down menu is changed. Here

15条回答
  •  南方客
    南方客 (楼主)
    2020-12-05 13:00

    Try using this :

    function checkValue(){
      var value = $('#doc_title').val();
      if (value.length > 0) {
            $('#doc_title').val("");
            $('#doc_title').focus();  // To focus the input 
        }
        else{
        //do something
        }
    }
    
    
    
    
    

提交回复
热议问题