Topic: Autocomplete clear cross deletes all inputs

KontYentE free asked 4 years ago

Hi there! This error can also be played in the mdbootstrap website under autocomplete Lets say we have two inputs type=search with autocomplete, and we fill both inputs. By clicking one cross, all the inputs get deleted. I've solutioned this by changing the mdb core code to check the id of the previous tag. Like this other solution, this only works as long as each individual input gets inside a div or h1 or em or whatever with an id. There are other ways around much cleaner than this one, but i don't have so much time to code anymore.
$("#" + n[0].offsetParent.attributes[1].nodeValue + " .mdb-autocomplete-clear").on("click", function(e) {
                    e.preventDefault(), n.val(""), $(this).css("visibility", "hidden"), t.empty(), $(this).parent().find("label").removeClass("active")

Mikołaj Smoleński staff answered 4 years ago

Hi there, Thanks for posting Your solution. Best Regards

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

  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.5.10
  • Device: Mac Book
  • Browser: Chrome
  • OS: iOS
  • Provided sample code: No
  • Provided link: Yes