jQuery – Which button is selected
To retrieve the value of the selected button: $(‘input[name=radioName]:checked’, ‘#myForm’).val()
Il n'y a pas de questions bêtes
To retrieve the value of the selected button: $(‘input[name=radioName]:checked’, ‘#myForm’).val()
To authenticate a cURL request in PHP, the option to know is CURLOPT_USERPWD. It sends a username / password pair in the user:password format. Basic authentication $ch = curl_init(‘https://exemple.com/api’); curl_setopt($ch, CURLOPT_USERPWD, ‘utilisateur:motdepasse’); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); $reponse = curl_exec($ch); if ($reponse === false) { throw new RuntimeException(curl_error($ch)); } curl_close($ch); Setting … Read more
jQuery-File-Upload How to use the basic solution from jQuery-File-Upload and make it work on every browser, with a special dedication to Internet Explorer. The basic version has the advantage of not being overloaded with libraries, and above all it is much easier to import into a site that already exists. Libraries <script type=”text/javascript” src=”//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”></script><script type=”text/javascript” … Read more
When it is necessary to have a predefined order in a query, it is possible to change the order of the items by using a CASE in the ORDER BY. In this example id 12 must appear before id 2. SELECT * FROM channel ORDER BY ( CASE WHEN id = 1 THEN 1 WHEN … Read more
In order for one CSS attribute to take precedence over another, for example when an item is defined by two classes, it is possible to use the !important option. For example: <div class=”style1 style2″></div> CSS: .style1 { background-color: #38c8ff; } .style2 { background-color: #ffffff !important; } The background will ultimately be white.
To focus the first field on your page, just use: $(“input:text:visible:first”).focus();