1

I want to add a default value to text input field in custom options to pass the magento validation. I try to do this in javascript like that: jQuery(".product-options dd input.input-text").attr('value', '--------'); But in some places I need to remove this value: jQuery(".product-options dd input.input-text").attr('value', ''); and when I use this last code, I have: Please specify the product's required option(s).

Thank you

2
  • you could specify by id instead of class so you can differentiate between which input textboxes need a value
    – Robin
    Apr 15, 2016 at 9:47
  • Hi Anja, yes this was problem :) you save my life, please add your answer, I will vote you
    – Robert
    Apr 15, 2016 at 11:40

1 Answer 1

2

you could specify by id instead of class so you can differentiate between which input textboxes need a value

i.e. instead of jQuery(".product-options dd input.input-text").attr('value', '--------'); you could use something like jQuery(".product-options dd input#youridhere").attr('value', '--------');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.