{"id":232,"date":"2023-01-13T07:56:06","date_gmt":"2023-01-13T07:56:06","guid":{"rendered":"http:\/\/javigomez.org\/?p=232"},"modified":"2025-09-29T20:34:20","modified_gmt":"2025-09-29T20:34:20","slug":"admitir-solo-numeros-en-un-input","status":"publish","type":"post","link":"https:\/\/javigomez.org\/index.php\/2023\/01\/13\/admitir-solo-numeros-en-un-input\/","title":{"rendered":"Admitir solo n\u00fameros en un Input"},"content":{"rendered":"\n<p>Es posible que en alg\u00fan formulario necesitemos que solo se permita introducir n\u00fameros. Para ello colocamos sobre el formulario una funci\u00f3n Javascript.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"http:\/\/javigomez.org\/wp-content\/uploads\/2023\/01\/image-10-1-1.png\" alt=\"\" class=\"wp-image-233\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;input type=\"text\" name=\"telefono\" id=\"itlf\" class=\"camp\" maxlength=\"9\" onkeypress=\"return soloNumeros(event);\" \/>\n\n\n\n        function soloNumeros(e) {\n            var keynum = window.event ? window.event.keyCode : e.which;\n            if (keynum == 8) return true;\n            return \/\\d\/.test(String.fromCharCode(keynum));\n        }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Es posible que en alg\u00fan formulario necesitemos que solo se permita introducir n\u00fameros. Para ello colocamos sobre el formulario una funci\u00f3n Javascript.<\/p>\n","protected":false},"author":1,"featured_media":233,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[196,205,242],"class_list":["post-232","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript","tag-input","tag-javascritp","tag-numeros"],"_links":{"self":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/232","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/comments?post=232"}],"version-history":[{"count":1,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/232\/revisions"}],"predecessor-version":[{"id":958,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/posts\/232\/revisions\/958"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media\/233"}],"wp:attachment":[{"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/media?parent=232"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/categories?post=232"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/javigomez.org\/index.php\/wp-json\/wp\/v2\/tags?post=232"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}