Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/397.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 用户选择另一个字段后是否可以隐藏特定字段?_Javascript_Html_Jquery_Css - Fatal编程技术网

Javascript 用户选择另一个字段后是否可以隐藏特定字段?

Javascript 用户选择另一个字段后是否可以隐藏特定字段?,javascript,html,jquery,css,Javascript,Html,Jquery,Css,我需要创建一个允许我定义特定规则的IF。 我有一个客户门户页面,客户可以在其中打开票据。 开发该表单是为了插入一些信息,例如:“软件产品”和“环境”都定义为下拉列表。此外,我们还有其他字段,如“套件版本”。 如果我需要的话: 如果(软件产品='TEST'),则隐藏字段“套件版本” 这是必要的,因为“测试”值将打开“软件产品”字段的一个新级别。 我可以使用jqueryjavascript 非常感谢。你可以试试js css JS 这就是你想要的吗??检查下面的代码 $(文档).ready(函数()

我需要创建一个允许我定义特定规则的IF。 我有一个客户门户页面,客户可以在其中打开票据。 开发该表单是为了插入一些信息,例如:“软件产品”和“环境”都定义为下拉列表。此外,我们还有其他字段,如“套件版本”。 如果我需要的话:

如果(软件产品='TEST'),则隐藏字段“套件版本”

这是必要的,因为“测试”值将打开“软件产品”字段的一个新级别。 我可以使用jqueryjavascript

非常感谢。

你可以试试js

css

JS


这就是你想要的吗??检查下面的代码

$(文档).ready(函数(){
$('#SoftProd')。更改(函数(){
$('#pp').html($(this.val());
if($(this.val()=“Test”)
{
$('suitervision').hide();
}
其他的
{
$('suitervision').show();
}
});
});
软件产品
选择选项。。。
试验
其他

我尝试使用此代码,但不幸的是无法使用。 考虑到我是新的编程语言。< /P> jQuery(文档).ready(函数() var software_product=$(“#helpdesk_ticket_custom_field_cf_product_1815896”).val(); { if(软件产品==“AMHS”){ Jquery(“#helpdesk_ticket_custom_field_cf_suite_version_1815896”).parent().parent().hide(); } 否则{ Jquery(“#helpdesk_ticket_custom_field_cf_suite_version_1815896”).parent().parent().show(); }
});你当然可以这样做。到目前为止你试过什么?什么东西没有按预期工作?你卡在哪里了?你要找的JS行看起来是这样的:
if(software product==“test”){document.querySelector(“field”).style.display=“none”;}else{document.querySelector(“field”).style.display=“block”}
既然你在使用Jquery,你可以使用如下方法:$(#ideElement.show()或.hide()这里有这么多的例子来说明你所描述的,这些都没有帮助吗?这能回答你的问题吗?
 #Suite_Version {
     display: none;
  }
 var software_product = $('#software_product').val();
 if (software_product === "test") { 
      $("#Suite_Version").hide();
  } else {
      $("#Suite_Version").show();
 }