Sunday, 15 May 2011

javascript - JQuery Autocomplete doesnt close -


To display an autocomplete list in my JQuery, clicking on me has the following when closing the list: / P>

  $ (document) .bind ('click', function (event) {// Check that we did not click on the search box, if (! ($ (Event.target) Parents (). And itself () .is ('# showmore')) {$ (".ui-menu-item"). Display = 'none'; $ (".ui-menu-item"). ();}});  

The list closes, but not completely! The following image shows a small white area beneath the text box.

Enter image details here

HTML on the page below Shows:

  & lt; Ul class = "ui-autocomplete ui-front ui-menu ui-widget ui-widget-content ui -conner-all" id = "UIID-1" tabindex = "0" style = "display: block; top: 423.5625px ; Left: 272.875 px; width: 361px; "& gt; & Lt; / Ul & gt;  

Although I have stopped autocomplete and no one has set its display, still it is still!

According to your code,

you should hide ui- ul instead of menu-item .

So you have to have $ (".ui-menu"). Hide () to hide that white background element beneath the search box.

In your code,

  if (! ($ (Event.target). Parents (.) And manually (). ('#Somor')) {$ (".ui-menu") Hide (); }  

And you are following the snippet in your code:

  $ (".ui-menu-item"). Display = 'none';  

should be

  $ (".ui-menu-item"). Hide ();  

display is not a wrapped dom element in the property.

If you do not display: do any

  document.querySelectorAll (".ui-menu-item"). Style.display = "none";  

No comments:

Post a Comment