Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Dynamiczny słownik, Wordpress ew AngularJs
majweb
post
Post #1





Grupa: Zarejestrowani
Postów: 11
Pomógł: 0
Dołączył: 15.12.2014

Ostrzeżenie: (0%)
-----


Jak można obsłużyć funkcjonalność typu słownik, który ładuje dynamicznie terminy po wpisaniu w input fragmentu dowolnego terminu?
Go to the top of the page
+Quote Post
Mega_88
post
Post #2





Grupa: Zarejestrowani
Postów: 360
Pomógł: 34
Dołączył: 20.08.2011

Ostrzeżenie: (0%)
-----


Po wpisaniu na przykład "ar" będzie wyświetlał z tabeli "tabela" z "tytuł" pola zawierające "ar" itd, dopasuj do siebie i będzie git.

  1. <div class="form-group ">
  2. <label for="cname" class="control-label col-lg-2">Klient
  3. <div class="navduble">
  4. <div class="navlistnag">Musisz wprowadzić unikalną nazwę !<br />Sprawdź poniżej czy już taka istnieje !</div>
  5. <ul class="navListduble"><?php $query = mysql_query("SELECT * FROM tabela ORDER BY tytul ASC"); while($wynik=mysql_fetch_array($query)) { echo '<li>'.$wynik['tytul'].'</li>'; } ?></ul>
  6. </div>
  7. </label>
  8. <div class="col-lg-10">
  9. <input class=" form-control" id="cname" name="tytul" minlength="2" type="text" required />
  10. </div>
  11. </div>
  12. <script>
  13. $("#cname").keyup(function(){
  14. $(".navduble").show();
  15. });
  16.  
  17. $('#cname').keyup(function(){
  18. $('.navListduble>li').show()
  19. var valThis = $(this).val().toLowerCase();
  20. $('.navListduble>li').each(function(){
  21. var text = $(this).text().toLowerCase();
  22. (text.indexOf(valThis) == 0) ? $(this).show() : $(this).hide();
  23. });
  24. });
  25. </script>
  26.  


Ten post edytował Mega_88 22.07.2015, 23:35:45
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 14:07