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?

Était-ce utile?

La 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.

Autres conseils

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

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top