I see that there is this script -
http://community.marketo.com/MarketoArticle?id=kA050000000KyqqCAC
but what if you wanted to dynamically hide or show multiple fields?
Any help would be much appreciated.
Thank you!
Solved! Go to Solution.
<!-- jQuery Show Hide Toggle ! -->
<script type="text/javascript" src="/js/public/jquery-latest.min.js"></script>
<script type="text/javascript">
// set no conflict mode for jquery
var $jQ = jQuery.noConflict();
function updateProductCategory()
{
if(jQuery("#FIELD NAME").val() == "FIELD VALUE")
{
jQuery("#FIELD SELECTION").parents("li:first").show();
jQuery("#FIELD SELECTION").parents("li:first").show();
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
}
else if(jQuery("#FIELD NAME").val() == "FIELD VALUE")
{
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").show();
jQuery("#FIELD SELECTION").parents("li:first").show();
jQuery("#FIELD SELECTION").parents("li:first").show();
}
else
{
jQuery("#FIELD NAME").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
}
}
jQuery(document).ready
(
function()
{
updateProductCategory();
jQuery("#FIELD NAME").change
( function()
{
updateProductCategory();
}
);
}
);
</script>
<!-- jQuery Show Hide Toggle ! -->
<script type="text/javascript" src="/js/public/jquery-latest.min.js"></script>
<script type="text/javascript">
// set no conflict mode for jquery
var $jQ = jQuery.noConflict();
function updateProductCategory()
{
if(jQuery("#FIELD NAME").val() == "FIELD VALUE")
{
jQuery("#FIELD SELECTION").parents("li:first").show();
jQuery("#FIELD SELECTION").parents("li:first").show();
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
}
else if(jQuery("#FIELD NAME").val() == "FIELD VALUE")
{
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").show();
jQuery("#FIELD SELECTION").parents("li:first").show();
jQuery("#FIELD SELECTION").parents("li:first").show();
}
else
{
jQuery("#FIELD NAME").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
jQuery("#FIELD SELECTION").parents("li:first").hide();
}
}
jQuery(document).ready
(
function()
{
updateProductCategory();
jQuery("#FIELD NAME").change
( function()
{
updateProductCategory();
}
);
}
);
</script>