M
M
maiskiykot2019-12-25 15:01:13
JavaScript
maiskiykot, 2019-12-25 15:01:13

How to hide dom elements in a script?

Found a Goocompleter script based on mootools. Everything works fine, but here's one nuance I can't win - if you don't select values ​​from the autocompletion list, then the list continues to hang. How to make it cleared by timeout or by switching to another autocomplete field? The script itself is large - I don't know how to attach it here. Only a link to the source: Script In advance, all fenks!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
maiskiykot, 2019-12-26
@maiskiykot

I found the answer myself on the expanses of tyrnet. It was possible to fasten the timer directly to the procedure for forming a drop-down list. In general, it is surprising that the author wrote a good library, but did not take care of cleaning up the tails. Especially if you have to enter your value in the field with auto-coupling.

I
Ivan Bogachev, 2019-12-25
@sfi0zy

It’s hard to say without a working demo, but the following construction is repeated many times there:

// Hide typebox
if (this.options.use_typebox)
    this.typebox.empty();

// Hide new result list
if (this.options.use_listbox)			
    this.listbox.setStyle('display', 'none');

I think these actions should be used to hide elements in your case. You will get something like this:
var myAutocompleter = new GooCompleter(/*...*/);

if (/* что-то случилось */) {
    myAutocompleter.typebox.empty();
    myAutocompleter.listbox.setStyle('display', 'none');
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question