background preloader

JS / JS LIB / JQuery

Facebook Twitter

jQuery API Documentation. jQuery Learning Center. Javascript Cheat Sheet. Basic Objects Math Methods DOM Events Event Object Constant Event Object Methods initEvent() preventDefault() stopPropagation() EventTarget Object addEventListener() dispatchEvent() removeEventListener() EventListener Object handleEvent() MouseEvent/KeyboardEvent Methods initMouseEvent() initKeyboardEvent() DOM Node Node Types Element1 Attr2 Text3 CDATASection4 EntityReference5 Entity6 ProcessingInstruction7 Comment8 Document9 DocumentType10 DocumentFragment11 Notation12 nodeName Returns Element element name Attr attribute name Text #text CDATASection #cdata-section EntityReference entity reference name Entity entity name ProcessingInstruction target Comment #comment Document #document DocumentType doctype name DocumentFragment #document fragment Notation notation name nodeValue Returns RegExp Modifiers i Perform case-insensitive matching g Perform a global match (find all matches rather than stopping after the first match) m Perform multiline matching Brackets Metacharacters .

Javascript Cheat Sheet

Quantifiers Core DOM length Ad. jQuery, remplir une liste déroulante selon une autre liste – chez Syl. Dynamic Dependent Select Box using Jquery and Ajax. How to do dynamic dependent select box using Jquery, Ajax, PHP and Mysql.

Dynamic Dependent Select Box using Jquery and Ajax

Dependent select box when a selection is made in a "Parent" box it allow to refresh a "child" box list data. In this post I had given a database relationship example betweent "catergory" and "subcategory". It's very simple jquery code hope you like this. Download Script Live Demo Database Sample database tables. CREATE TABLE 'data' ( 'id' int primary keyauto_increment, 'data' varchar(50), 'weight' int(2), ); CREATE TABLE `data_parent` ( `pid` int(11) primary key auto_increment, `did` int(11) unique, `parent` int(11),Foreign key(did) references data(id) ) Data storing like data_parent sections_demo.php Contains javascipt and PHP code. $(".country").change(function(){}- country is the class name of select box. <script type="text/javascript" src=" type="text/javascript"> $(document).ready(function() { $(".country").change(function() {var id=$(this).val();var dataString = 'id='+ id;

EncodeURIComponent() La fonction encodeURIComponent() permet d'encoder un composant d'un Uniform Resource Identifier (URI) en remplaçant chaque exemplaire de certains caractères par une, deux, trois ou quatres séquences d'échappement UTF-8 correspondantes (quatre séquences seront utilisées uniquement lorsque les caractères à encoder sont composés de deux caractères « surrogate »).


SyntaxeEdit encodeURIComponent(); Paramètres str Une chaîne de caractères qui correspond à un composant d'URI. Valeur de retour Une nouvelle chaîne de caractères qui représente un composant d'URI obtenu en encodant la chaîne passée en argument. DescriptionEdit encodeURIComponent() échappe tous les caractères sauf : les lettres de l'alphabet latin, les chiffres (arabes) et - _ . ! Un exception URIError sera levée lorsqu'on utilise cette fonction sur un unique demi-codet qui est censé faire partie d'une paire de demi-codets : Pour utiliser une fonction qui respecte la RFC 3986, plus stricte (qui réserve les caractères !

ExemplesEdit Merci ! Examples - Select2. Single select boxes Select2 can take a regular select box like this... and turn it into this...

Examples - Select2

Alaska Multiple select boxes Select2 also supports multi-value select boxes. Select boxes with labels You can, and should, use a <label> with Select2, just like any other <select> element. A placeholder value can be defined and will be displayed until a selection is made. Select a state In addition to handling options from a standard <select>, Select2 can also retrieve the results from other data sources. Loading array data Select2 provides a way to load the data from a local array. Enhancement duplicate Loading remote data Select2 comes with AJAX support built in, using jQuery's AJAX methods.

Select2/select2 When using Select2 with remote data, the HTML required for the select is the same as any other Select2. You can configure how Select2 searches for remote data using the ajax option. Select2 will pass any options in the ajax object to jQuery's $.ajax function, or the transport function you specify. AngularJS — Superheroic JavaScript MVW Framework.