This is my code of title.phtml. Here I want to show attribute when I select dropdown value and hide when I didnot select any value from my attribute dropdown list.
Here in code I added span with class rx, I want to show attribute value in this code. My attribute code is also "rx"
Thanks in Advance
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* @var $block \Magento\Theme\Block\Html\Title
*/
$cssClass = $block->getCssClass() ? ' ' . $block->getCssClass() : '';
$titleHtml = '';
if (trim($block->getPageHeading())) {
$titleHtml = '<span class="base" data-ui-id="page-title-wrapper" '
. $block->getAddBaseAttribute()
. '>'
. $block->escapeHtml($block->getPageHeading())
. '</span>';
}
?>
<?php if ($titleHtml) : ?>
<div class="page-title-wrapper<?= $block->escapeHtmlAttr($cssClass) ?>">
<h1 class="page-title"
<?php if ($block->getId()) : ?> id="<?= $block->escapeHtmlAttr($block->getId()) ?>" <?php endif; ?>
<?php if ($block->getAddBaseAttributeAria()) : ?>
aria-labelledby="<?= $block->escapeHtmlAttr($block->getAddBaseAttributeAria()) ?>"
<?php endif; ?>>
<?= /* @noEscape */ $titleHtml ?>
<span class="rx">
</span>
</h1>
<?= $block->getChildHtml() ?>
</div>
<?php endif; ?>