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?

有帮助吗?

解决方案

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.

其他提示

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top