Proto pisu, ze chci videt i zbytek kodu, protoze se neda zjistit, proc mu to jako nefunfuje, kdyz to tam ma :)
Příspěvky odeslané z IP adresy 2001:718:2601:258:680c:7c11:969d:333...–
gna - On ten kod tam ma. Nejde uplne o muj napad. Je to jeden z poslednich radku prvniho prispevku. Jen jsem to vypichl.
Jinymi slovy, zkus si tam dat mereni casu, a tva funkce by to mela delat mnohem pomaleji. Navic dela nektere veci uplne zbytecne :)
Proc treba na zacatku nahrazovat mezeru minuskem, kdyz pozdeji nahrazuje non-alfa, non-digit za minus, mezera do toho take spada :)
https://mlich.zam.slu.cz/wys4.htm
// muj js kod
odstranDiakritiku(str) - zbav se diakritiky (abyde ti AZaz09 a bordel)
.toLowerCase() - zmen na mala pismena (zbyde az09 a bordel)
.replace(new RegExp('[^a-z0-9]+','g'),'_') - nahrad vse, co neni pismeno nebo cislo (a opakovani) podtrzitkem _ (zbyde az09 a podtrzitka pred-za-mezi znaky)
.replace(new RegExp('(^_)|(_$)','g'),''); - odstran podtrzitka ze zacatku a z konce
v jakemsi html2pdf pouzivaji tuto funkci na diakritiku - maji tam nektere znaky navic, jine vubec. Momentalce nemuzu najit nejakou vlastni funkci. mozna jednu.
function _iso2ascii($s) {
$iso="áäčďéěíľĺňóöőôřŕšťúůüűýžÁÄČĎÉĚÍĽĹŇÓÖŐÔŘŔŠŤÚŮÜŰÝŽ";
$asc="aacdeeillnoooorrstuuuuyzAACDEEILLNOOOORRSTUUUUYZ";
return strtr($s,$iso,$asc);
}
function odstranDiakritiku($subject)
{
$search = array("á","ä","č","ď","é","ě","í","ĺ","ľ","ň","ó","ô","ö","ŕ","š","ť","ú","ů","ü","ý","ř","ž","Á","Ä","Č","Ď","É","Ě","Í","Ĺ","Ľ","Ň","Ó","Ô","Ö","Ŕ","Š","Ť","Ú","Ů","Ü","Ý","Ř","Ž");
$replace = array("a","a","c","d","e","e","i","l","l","n","o","o","o","r","s","t","u","u","u","y","r","z","A","A","C","D","E","E","I","L","L","N","O","O","O","R","S","T","U","U","U","Y","R","Z");
return str_replace($search, $replace, $subject);
}
https://jqueryui.com/datepicker/
zkopiruji jejich kod na jsfiddle https://jsfiddle.net/xzpgbw47/
A pridam 3 inputy (copy paste) + zmenim jim id na class + pridam inicializaci pro class = a vidim, ze to funguje. Takze ten js mas nejspis spravne. Nevim, co ti odpovedet na dotaz :)
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Datepicker - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script>
$( function() {
$( "#datepicker" ).datepicker();
$( ".datepicker" ).datepicker();
} );
</script>
</head>
<body>
<p>Date: <input type="text" id="datepicker"></p>
<p>Date: <input type="text" class="datepicker"></p>
<p>Date: <input type="text" class="datepicker"></p>
<p>Date: <input type="text" class="datepicker"></p>
</body>
</html>
Zas ti moc nerozumim, dotazu...
$("#datepicker") - nastav 1 elementu, ktery ma unikatni id=datapicker
$(".datepicker") - nastav vsem elementum, ktere maji class=datapicker
To tam mas. A ten kod ti nefunguje nebo, jak?
Zkousel jsi sem nekdy pridat jednoduchy spustitelny-kopirovatelny kod? Nejakou tabulku, kde mas 2-3-4 inputy a pouzity link na js jquery a ten datapicker? Kod, ktery bychom mohli spustit a testovat a ne hadata, co tam jeste mas? :)
Kdyz pouzijes id, tak id muze mit jen jeden element, class vice. Ale pozor, mrkni na kod toho datapickeru, zda neobsahuje prave class 'datapicker' pro nejaky vnitrni element. Ja bych tam mozna pro test pouzil vlastni class 'xdatapicker', abych mel jistotu (pokud to teda nefunguje)
- cili, bud tam nemas element, ktery ma class datapicker (z tveho neuplneho kodu se tohle neda vycist)
- nebo ta class se bije s podobnou class, kterou tam generuje ten kod element.datapicker() (to bych si musel napsat vlastni kod, protoze tvuj neni mozne pouzit a otestovat si to)
Psat si vlastni kod se mi skutecne nechce, abych zjistil, treba, ze vlastne, co jsi napsal je spravne a chybu as v html, kde mas stale inpu id=datapicker misto input class=datapicker nebo nejaky preklep jako Datapicker, dataPicker datapiker data-picker