{"id":10858,"date":"2013-11-12T16:47:00","date_gmt":"2013-11-12T16:47:00","guid":{"rendered":"https:\/\/kiencang.net\/2013\/11\/12\/thuoc-tinh-required-cua-the-input\/"},"modified":"2013-11-12T16:47:00","modified_gmt":"2013-11-12T16:47:00","slug":"thuoc-tinh-required-cua-the-input","status":"publish","type":"post","link":"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/","title":{"rendered":"Thu\u1ed9c t\u00ednh required c\u1ee7a th\u1ebb input"},"content":{"rendered":"\n

Thu\u1ed9c t\u00ednh required l\u00e0 thu\u1ed9c t\u00ednh m\u1edbi trong HTML5 d\u00e0nh cho th\u1ebb input<\/a>. T\u00e1c d\u1ee5ng c\u1ee7a required\u00a0l\u00e0 bu\u1ed9c ng\u01b0\u1eddi d\u00f9ng ph\u1ea3i nh\u1eadp d\u1eef li\u1ec7u th\u00ec m\u1edbi g\u1eedi \u0111\u01b0\u1ee3c (submit). <\/p>\n\n\n\n

D\u0129 nhi\u00ean thao t\u00e1c n\u00e0y \u0111\u1ee1 cho ch\u00fang ta kh\u00e1 nhi\u1ec1u code JavaScript ho\u1eb7c PHP d\u00f9ng \u0111\u1ec3 validate c\u00e1c tr\u01b0\u1eddng kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p \u0111\u1ec3 tr\u1ed1ng.<\/p>\n\n\n\n

Code m\u1eabu:<\/p>\n\n\n\n

<form action=\"#\">\n   <label>H\u1ecd t\u00ean:<input type=\"text\"  name=\"hoten\" required<\/strong>><\/label>\n   <input type=\"submit\" value=\"G\u1eedi\">\n<\/form><\/code><\/pre>\n\n\n\n

K\u1ebft qu\u1ea3:<\/p>\n\n\n\n

Nh\u1eefng th\u1ebb input type d\u00f9ng requried<\/h2>\n\n\n\n

C\u00e1c input sau \u0111\u00e2y d\u00f9ng thu\u1ed9c t\u00ednh requried:\u00a0text, checkbox, radio<\/a>,\u00a0email, password (m\u1eadt kh\u1ea9u),\u00a0search (t\u00ecm ki\u1ebfm), url, tel (s\u1ed1 \u0111i\u1ec7n tho\u1ea1i), date pickers (ch\u1ecdn ng\u00e0y th\u00e1ng), number, file.<\/p>\n\n\n\n

C\u00e1ch d\u00f9ng<\/strong><\/p>\n\n\n\n

Required l\u00e0 thu\u1ed9c t\u00ednh ki\u1ec3u boolean, ngh\u0129a l\u00e0 n\u00f3 ch\u1ec9 nh\u1eadn 2 gi\u00e1 tr\u1ecb c\u00f3 ho\u1eb7c kh\u00f4ng c\u00f3. N\u1ebfu kh\u00f4ng c\u00f3 requried trong th\u1ebb input ngh\u0129a l\u00e0 kh\u00f4ng y\u00eau c\u1ea7u ph\u1ea3i nh\u1eadp \u0111\u1ee7 d\u1eef li\u1ec7u, ng\u01b0\u1ee3c l\u1ea1i n\u1ebfu c\u00f3 th\u00ec ph\u1ea3i nh\u1eadp \u0111\u1ee7 m\u1edbi \u0111\u01b0\u1ee3c Submit.<\/p>\n\n\n\n

C\u00f3 s\u1ef1 kh\u00e1c bi\u1ec7t gi\u1eefa XHTML v\u00e0 HTML<\/a>. V\u00ec XHTML kh\u00f4ng cho ph\u00e9p r\u00fat g\u1ecdn thu\u1ed9c t\u00ednh cho n\u00ean v\u1edbi XHTML ch\u00fang ta ph\u1ea3i vi\u1ebft \u0111\u1ea7y \u0111\u1ee7 nh\u01b0 sau:\u00a0<\/p>\n\n\n\n

<input required=\"required\" \/><\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"

Thu\u1ed9c t\u00ednh required l\u00e0 thu\u1ed9c t\u00ednh m\u1edbi trong HTML5 d\u00e0nh cho th\u1ebb input. T\u00e1c d\u1ee5ng c\u1ee7a required\u00a0l\u00e0 bu\u1ed9c ng\u01b0\u1eddi d\u00f9ng ph\u1ea3i nh\u1eadp d\u1eef li\u1ec7u th\u00ec m\u1edbi g\u1eedi \u0111\u01b0\u1ee3c (submit). D\u0129 nhi\u00ean thao t\u00e1c n\u00e0y \u0111\u1ee1 cho ch\u00fang ta kh\u00e1 nhi\u1ec1u code JavaScript ho\u1eb7c PHP d\u00f9ng \u0111\u1ec3 validate c\u00e1c tr\u01b0\u1eddng kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p \u0111\u1ec3 tr\u1ed1ng. Code …<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[235],"tags":[],"yoast_head":"\nThu\u1ed9c t\u00ednh required c\u1ee7a th\u1ebb input • Ki\u1ebfn c\u00e0ng<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/\" \/>\n<meta property=\"og:locale\" content=\"vi_VN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Thu\u1ed9c t\u00ednh required c\u1ee7a th\u1ebb input • Ki\u1ebfn c\u00e0ng\" \/>\n<meta property=\"og:description\" content=\"Thu\u1ed9c t\u00ednh required l\u00e0 thu\u1ed9c t\u00ednh m\u1edbi trong HTML5 d\u00e0nh cho th\u1ebb input. T\u00e1c d\u1ee5ng c\u1ee7a required\u00a0l\u00e0 bu\u1ed9c ng\u01b0\u1eddi d\u00f9ng ph\u1ea3i nh\u1eadp d\u1eef li\u1ec7u th\u00ec m\u1edbi g\u1eedi \u0111\u01b0\u1ee3c (submit). D\u0129 nhi\u00ean thao t\u00e1c n\u00e0y \u0111\u1ee1 cho ch\u00fang ta kh\u00e1 nhi\u1ec1u code JavaScript ho\u1eb7c PHP d\u00f9ng \u0111\u1ec3 validate c\u00e1c tr\u01b0\u1eddng kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p \u0111\u1ec3 tr\u1ed1ng. Code …\" \/>\n<meta property=\"og:url\" content=\"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/\" \/>\n<meta property=\"og:site_name\" content=\"Ki\u1ebfn c\u00e0ng\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/anhducnguyen87\/\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-12T16:47:00+00:00\" \/>\n<meta name=\"author\" content=\"Nguy\u1ec5n \u0110\u1ee9c Anh\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nguy\u1ec5n \u0110\u1ee9c Anh\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 ph\u00fat\" \/>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Thu\u1ed9c t\u00ednh required c\u1ee7a th\u1ebb input • Ki\u1ebfn c\u00e0ng","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/","og_locale":"vi_VN","og_type":"article","og_title":"Thu\u1ed9c t\u00ednh required c\u1ee7a th\u1ebb input • Ki\u1ebfn c\u00e0ng","og_description":"Thu\u1ed9c t\u00ednh required l\u00e0 thu\u1ed9c t\u00ednh m\u1edbi trong HTML5 d\u00e0nh cho th\u1ebb input. T\u00e1c d\u1ee5ng c\u1ee7a required\u00a0l\u00e0 bu\u1ed9c ng\u01b0\u1eddi d\u00f9ng ph\u1ea3i nh\u1eadp d\u1eef li\u1ec7u th\u00ec m\u1edbi g\u1eedi \u0111\u01b0\u1ee3c (submit). D\u0129 nhi\u00ean thao t\u00e1c n\u00e0y \u0111\u1ee1 cho ch\u00fang ta kh\u00e1 nhi\u1ec1u code JavaScript ho\u1eb7c PHP d\u00f9ng \u0111\u1ec3 validate c\u00e1c tr\u01b0\u1eddng kh\u00f4ng \u0111\u01b0\u1ee3c ph\u00e9p \u0111\u1ec3 tr\u1ed1ng. Code …","og_url":"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/","og_site_name":"Ki\u1ebfn c\u00e0ng","article_author":"https:\/\/www.facebook.com\/anhducnguyen87\/","article_published_time":"2013-11-12T16:47:00+00:00","author":"Nguy\u1ec5n \u0110\u1ee9c Anh","twitter_card":"summary_large_image","twitter_misc":{"\u0110\u01b0\u1ee3c vi\u1ebft b\u1edfi":"Nguy\u1ec5n \u0110\u1ee9c Anh","\u01af\u1edbc t\u00ednh th\u1eddi gian \u0111\u1ecdc":"2 ph\u00fat"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/","url":"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/","name":"Thu\u1ed9c t\u00ednh required c\u1ee7a th\u1ebb input • Ki\u1ebfn c\u00e0ng","isPartOf":{"@id":"https:\/\/kiencang.net\/#website"},"datePublished":"2013-11-12T16:47:00+00:00","dateModified":"2013-11-12T16:47:00+00:00","author":{"@id":"https:\/\/kiencang.net\/#\/schema\/person\/5e7e1a04d8d1218ad8c421ba43d25c16"},"breadcrumb":{"@id":"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/#breadcrumb"},"inLanguage":"vi","potentialAction":[{"@type":"ReadAction","target":["https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/kiencang.net\/thuoc-tinh-required-cua-the-input\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/kiencang.net\/"},{"@type":"ListItem","position":2,"name":"Thu\u1ed9c t\u00ednh required c\u1ee7a th\u1ebb input"}]},{"@type":"WebSite","@id":"https:\/\/kiencang.net\/#website","url":"https:\/\/kiencang.net\/","name":"Ki\u1ebfn c\u00e0ng","description":"\u00d4m l\u00fd thuy\u1ebft, h\u00f4n th\u1ef1c h\u00e0nh","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/kiencang.net\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"vi"},{"@type":"Person","@id":"https:\/\/kiencang.net\/#\/schema\/person\/5e7e1a04d8d1218ad8c421ba43d25c16","name":"Nguy\u1ec5n \u0110\u1ee9c Anh","image":{"@type":"ImageObject","inLanguage":"vi","@id":"https:\/\/kiencang.net\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/6d71f9b89393952a8382e30dad26c1ec?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/6d71f9b89393952a8382e30dad26c1ec?s=96&d=monsterid&r=g","caption":"Nguy\u1ec5n \u0110\u1ee9c Anh"},"description":"Sinh n\u0103m 1987, t\u1ed1t nghi\u1ec7p Cao \u0111\u1eb3ng th\u1ef1c h\u00e0nh FPT qu\u00e3ng 2014, chuy\u00ean ng\u00e0nh Thi\u1ebft k\u1ebf website. T\u00f4i th\u00edch Content, SEO, Ads, T\u0103ng t\u1ed1c website v\u00e0 Th\u01b0\u01a1ng m\u1ea1i \u0111i\u1ec7n t\u1eed. B\u00ean c\u1ea1nh b\u00e0i t\u1ef1 vi\u1ebft, t\u00f4i c\u0169ng d\u1ecbch nhi\u1ec1u n\u1ed9i dung th\u00fa v\u1ecb c\u1ee7a c\u00e1c t\u00e1c gi\u1ea3 kh\u00e1c nhau. FB c\u00e1 nh\u00e2n: facebook.com\/anhducnguyen87. Email li\u00ean h\u1ec7: guiemailchotoi@gmail.com","sameAs":["https:\/\/www.facebook.com\/anhducnguyen87\/"],"url":"https:\/\/kiencang.net\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/posts\/10858"}],"collection":[{"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/comments?post=10858"}],"version-history":[{"count":0,"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/posts\/10858\/revisions"}],"wp:attachment":[{"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/media?parent=10858"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/categories?post=10858"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kiencang.net\/wp-json\/wp\/v2\/tags?post=10858"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}