How to declare value inside the script?

Code :

<input type="radio" value="foo" name="obtrusive-radio">
document.addEventListener('click', function (event) {
  if (event.target.name === 'obtrusive-radio') {
  	alert(event.target.value)
  }
})

How to declare value inside the script?

The script retrieves the value from the input field.

What are you wanting to achieve?

Yes, i am using magento in checkout page customer should select courier service as their wish, if customer select radio button i need to show popup message.

my courier selection code like :

<span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
<?php else: ?>

<input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?> "<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>

and output :

I hope my point clear.

In that case I as a customer am going to bugger off to a competitor, because you are doing strange and unusual upsetting things.

1 Like

No, not permanently for this corona time only after we will remove.

In that case don’t hide it. Just put it on the screen.

1 Like

yes, that’s what i will do, if click courier service show popup message like “Delivery may delay due to covid-19”

Is the reason for wanting a popup, because company owners don’t want to place the text (possibly in parenthesis), at the end of the line?

Slighty Off-Topic:

Every site I’ve visited recently has a notice prominently on their home page, and often elsewhere, stating “we are working normally during COVID-19” or “we are experiencing a higher-than-usual volume of orders and there may be some delay” or whatever.

The point is that the customer knows before going through the ordering process whether there will be a delay to the order and whether to proceed or look elsewhere. I’d find it really annoying to complete the whole process and then only be warned of possible delays at the last minute.

4 Likes

Agreed. To expand on my comment from post #5, hiding such a message until after I’ve finished shopping and am about to pay for it, makes it feel like your company is trying to hide something.

That causes me to have bad feelings about your company and because of your delaying information like that until I select my delivery option, you will lose me (and many other customers) to some other company that behaves better towards me.

Please do not bleed customers at this stage. You need every one of them to be on your side.

Make the covid message prominent and easy for your customers to be aware of. They will thank you with their custom.

3 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.