{"id":209,"date":"2019-10-24T22:43:33","date_gmt":"2019-10-25T01:43:33","guid":{"rendered":"http:\/\/fabiobrandao.net.br\/blog\/?p=209"},"modified":"2023-03-11T23:59:49","modified_gmt":"2023-03-12T02:59:49","slug":"jquery-ativar-ou-desativar-elemento-de-formulario","status":"publish","type":"post","link":"https:\/\/fabiobrandao.net.br\/blog\/javascript-e-bivliotecas\/jquery-ativar-ou-desativar-elemento-de-formulario\/","title":{"rendered":"jQuery &#8211; Ativar ou Desativar elemento de formul\u00e1rio"},"content":{"rendered":"<p>Quando trabalhamos com formul\u00e1rios em alguns casos \u00e9 necess\u00e1rio habilitar ou desabilitar um elemento dependendo das escolhas que o usu\u00e1rio fizer. Suponha que em fun\u00e7\u00e3o da sele\u00e7\u00e3o do usu\u00e1rio, alguns campos ficam dispon\u00edveis para preenchimento enquanto outros n\u00e3o. Para setar esta propriedade para um elemento de formul\u00e1rio basta usar uma das instru\u00e7\u00f5es abaixo:<\/p>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\/\/ Desativar\r\n$(&quot;#elementId&quot;).prop(&quot;disabled&quot;, true);\r\n<\/pre>\n<pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\r\n\/\/ Desativar\r\n$(&quot;#elementId&quot;).prop(&quot;disabled&quot;, false);\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Quando trabalhamos com formul\u00e1rios em alguns casos \u00e9 necess\u00e1rio habilitar ou desabilitar um elemento dependendo das escolhas que o usu\u00e1rio fizer. Suponha que em fun\u00e7\u00e3o da sele\u00e7\u00e3o do usu\u00e1rio, alguns&#8230; <\/p>\n","protected":false},"author":1,"featured_media":377,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[69],"tags":[38,35,36,37,9],"class_list":["post-209","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-javascript-e-bivliotecas","tag-ativar","tag-desativar","tag-elemento","tag-formulario","tag-jquery"],"_links":{"self":[{"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/posts\/209","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/comments?post=209"}],"version-history":[{"count":2,"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/posts\/209\/revisions"}],"predecessor-version":[{"id":379,"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/posts\/209\/revisions\/379"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/media\/377"}],"wp:attachment":[{"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/media?parent=209"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/categories?post=209"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fabiobrandao.net.br\/blog\/wp-json\/wp\/v2\/tags?post=209"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}