سؤال

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