Einar Johnsen pro asked 8 years ago

Having trouble unfocusing input forms after clicking a button that removes the content. The content removes, but the input field stays focused. Any ideas how to fix?

Michal Szymanski staff answered 8 years ago

I'm glad you like it. Anyway, I'm afraid it's Angular issue, not MDB and you probably should ask the question in some Angular community. I don't know the answer for your question, I'm sorry.

Einar Johnsen pro answered 8 years ago

Im using it together with Angularjs, and my html looks like this: `<div class="row card-content wow zoomInLeft"> <div class="input-field col-md-12"> <textarea ng-model="BodySubject" id="textarea" class="materialize-textarea" length="120"></textarea> <label for="textarea">Textarea</label> </div> </div> <br /> <div class="row card-content wow zoomInRight"> <div class="col-md-12 text-center"> <button type="submit" id="SendMail" class="btn btn-success glyphicon glyphicon-send" ng-click="sendStuff()"></button> </div> </div>` And I'm sending an http request to my API, but when I get the respond, I want to clear the fields. When I get the respond I tried: $scope.BodySubject = null; The text is removed, but the textarea is still highlighted like there is text in it. I also tried to use blur, but I did not see any changes. I notice when I click on the button it tries to take focus away, but there is still text in it. So is there a way to unfocus when i get my response from an API? Sorry for the basic question, pretty new to both Angularjs and MDB, using it in a school project, and think the design is great! Great work!

Michal Szymanski staff answered 8 years ago

Can you provide sample code of the script removing content?

Please insert min. 20 characters.


Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.


Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No