autoComplete tag appears on the wrong place

I'm using PrimeFaces and JSF to do my school work and used jQueryUI Theme roller to style it, and the specific tag: <p:autoComplete> has a bug when the CSS is active (when I disable css it works fine), this is how it looks:bug

enter image description here

the autoComplete should be right beside "Modelo:", but it's on the page corner.

I've found this code with "autocomplete":

.ui-autocomplete {
    position: absolute;
    top: 0;
    left: 0;
    cursor: default;
}

This same code also appears in jquery-ui.css and jquery-ui.structure.css. There are also some JavaScript codes with "autocomplete", but they were to big to put in here so I placed them on this link: http://hostcode.sourceforge.net/view/4282

I don't understand much of CSS and Javascript, so I'm asking you guys to help me with this bug.

FYI: I'm using the <p:autocomplete> inside a <p:panelGrid>, also, sorry for the English mistakes :)

Upvotes: 1

Views: 491

Answers (2)

it was far more simple to solve this, I've just changed .ui-autocomplete position in css, from absolute to relative, of course, I've to change in every file that .ui-autocomplete appeared

Upvotes: 2

Venkat.R
Venkat.R

Reputation: 7746

Use jQuery and jQuery UI Refer the below Snippet.

Reference URL: https://jqueryui.com/autocomplete/

$(function() {
    var availableTags = [
      "ActionScript",
      "AppleScript",
      "Asp",
      "BASIC",
      "C",
      "C++",
      "Clojure",
      "COBOL",
      "ColdFusion",
      "Erlang",
      "Fortran",
      "Groovy",
      "Haskell",
      "Java",
      "JavaScript",
      "Lisp",
      "Perl",
      "PHP",
      "Python",
      "Ruby",
      "Scala",
      "Scheme"
    ];
    $( "#tags" ).autocomplete({
      source: availableTags
    });
  });
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">

<div class="ui-widget">
  <label for="tags">Tags: </label>
  <input id="tags">
</div>

Upvotes: 1

Related Questions