{"id":1048,"date":"2013-01-08T14:49:26","date_gmt":"2013-01-08T13:49:26","guid":{"rendered":"https:\/\/www.unicoda.com\/?p=1048"},"modified":"2013-01-09T17:44:52","modified_gmt":"2013-01-09T16:44:52","slug":"placer-le-focus-a-la-fin-dun-champ-place-focus-at-the-end-of-a-field","status":"publish","type":"post","link":"https:\/\/www.unicoda.com\/?p=1048","title":{"rendered":"Placer le focus \u00e0 la fin d&rsquo;un champ \/  Place focus at the end of a field"},"content":{"rendered":"<pre>function setFocusBack (element) {\r\n  var tmp = element.val();\r\n  element.focus().val('');\r\n  element.val(tmp);\r\n}<\/pre>\n<p>O\u00f9 <em>element<\/em> est une s\u00e9lection JQuery comme par exemple: $(&lsquo;.text&rsquo;).<br \/>\nCette fonction permet donc de remettre facilement le focus \u00e0 la fin d&rsquo;un champ d&rsquo;input (par exemple).<\/p>\n<p>Where <em>element<\/em> is a JQuery selector like for instance $(&lsquo;.text&rsquo;).<br \/>\nThis function allows us to easily set the focus back at the end of an input field (for instance).<\/p>\n<p>Html:<\/p>\n<pre>&lt;input type=\"text\" placeholder=\"ER\" class=\"text\"\/&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>function setFocusBack (element) { var tmp = element.val(); element.focus().val(\u00a0\u00bb); element.val(tmp); } O\u00f9 element est une s\u00e9lection JQuery comme par exemple: $(&lsquo;.text&rsquo;). Cette fonction permet donc de remettre facilement le focus \u00e0 la fin d&rsquo;un champ d&rsquo;input (par exemple). Where element is a JQuery selector like for instance $(&lsquo;.text&rsquo;). This function allows us to easily set &hellip; <a href=\"https:\/\/www.unicoda.com\/?p=1048\" class=\"more-link\">Continuer la lecture<span class=\"screen-reader-text\"> de &laquo;&nbsp;Placer le focus \u00e0 la fin d&rsquo;un champ \/  Place focus at the end of a field&nbsp;&raquo;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[96,13,95],"class_list":["post-1048","post","type-post","status-publish","format-standard","hentry","category-code","tag-focus","tag-javascript","tag-jquery"],"_links":{"self":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1048","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1048"}],"version-history":[{"count":3,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1048\/revisions"}],"predecessor-version":[{"id":1050,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=\/wp\/v2\/posts\/1048\/revisions\/1050"}],"wp:attachment":[{"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.unicoda.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}