Hi @ronnie09 ,
Try with below code snippet
JS File :
(function($, $document) {
"use strict";
$(document).on("foundation-contentloaded", function(e) {
$("#tabhideandshow").each(function() {
showHide();
});
});
$document.on("change", ".textType", function(e) {
showHide();
});
function showHide() {
var list = $("#tabhideandshow").find("coral-tab");
let contained = $(".contained").prop("selected");
if (contained) {
list[1].removeAttribute("hidden");
} else {
list[1].setAttribute("hidden", true)
}
}
})($, $(document));
content.xml
<?xml version="1.0" encoding="UTF-8"?>
<jcr:root xmlns:sling="http://sling.apache.org/jcr/sling/1.0" xmlns:granite="http://www.adobe.com/jcr/granite/1.0" xmlns:cq="http://www.day.com/jcr/cq/1.0" xmlns:jcr="http://www.jcp.org/jcr/1.0" xmlns:nt="http://www.jcp.org/jcr/nt/1.0"
jcr:primaryType="nt:unstructured"
jcr:title="default"
sling:resourceType="cq/gui/components/authoring/dialog"
extraClientlibs="[customValidation]"
mode="edit">
<content
granite:class="cq-dialog-content-page"
granite:id="tabhideandshow"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<tabs
granite:class="cq-siteadmin-admin-properties-tabs"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/tabs"
size="L">
<items jcr:primaryType="nt:unstructured">
<section
jcr:primaryType="nt:unstructured"
jcr:title="Default"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<text
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/include"
path="qcomm-martech/components/content/commonElements/text/text"/>
<texttype
granite:class="textType"
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/select"
emptyText="Select Text Type"
fieldDescription="Select Text Type"
fieldLabel="Text Type"
name="./textType">
<items jcr:primaryType="nt:unstructured">
<default
jcr:primaryType="nt:unstructured"
selected="{Boolean}true"
text="Default"
value="default"/>
<Contained
granite:class="contained"
jcr:primaryType="nt:unstructured"
text="Contained"
value="contained"/>
</items>
</texttype>
</items>
</column>
</items>
</section>
<contained
granite:class="contained-hide"
jcr:primaryType="nt:unstructured"
jcr:title="Contained"
sling:resourceType="granite/ui/components/coral/foundation/fixedcolumns">
<items jcr:primaryType="nt:unstructured">
<column
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/container">
<items jcr:primaryType="nt:unstructured">
<text
jcr:primaryType="nt:unstructured"
sling:resourceType="granite/ui/components/coral/foundation/form/textfield"
fieldDescription="Text"
fieldLabel="Text"
name="./text"/>
</items>
</column>
</items>
</contained>
</items>
</tabs>
</items>
</content>
</jcr:root>
Hope it works !!