cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 1.9 - How to declare two id or class name for single input field?

Magento 1.9 - How to declare two id or class name for single input field?

 
Magento 1 courier selection,

path : app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml

<span class="no-display"><input name="**bleep**() ?>" checked="checked" /></span>
<?php else: ?>

<input name="**bleep**()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>

The input field i need to declare another name for my popup message purpose i just declare script for same file location,

app/design/frontend/base/default/template/checkout/onepage/shipping_method/available.phtml

 

<script>
document.addEventListener('click', function (event) {
  if (event.target.name === 'obtrusive-radio') {
    alert(event.target.value)
  }
})
</script>

I want to assign the name obtrusive-radio but input field already have a name like "shipping_method"

1 REPLY 1

Re: Magento 1.9 - How to declare two id or class name for single input field?

Hello @Aveeva 

 

You can do it based on element ID, instead of name:

 

document.getElementById("myBtn").addEventListener("click"function(){
  document.getElementById("demo").innerHTML = "Hello World";
});

 

can't change name but you can have multiple classes to identify. Thanks 

Manish Mittal
https://www.manishmittal.com/