Question

How do I add an html class attribute to a block returned from

Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId())

in magento?

Is the only option to override the getCountryHtmlSelect() function?

Was it helpful?

Solution

Using jQuery,

$('#selectElementId').addClass('MyClass'); 
$('.selectElementClass').addClass('MyClass'); 

Using Plain Javascript,

document.getElementById("MyElementId").className += " MyClass";

Using PrototypeJS,

element.addClassName(className);

Or the other way, this link may help.

OTHER TIPS

I ended up copying Mage\Directory\Block\Data.php from app\code\core\ to app\code\local and modified the getCountryHtmlSelect() function setClass() order

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top