JavaScript If radio button answer is echo radio button answer,java radio button answer,html radio button

I want to check if the value of the radio is some value and if it is, it needs to echo a text line.

I use this code for the radio buttons:

<li>
    <label for="recommend_field"><?php echo $this->__('Would you recommend this product to a friend?') ?></label>
    <div class="input-box">
            <?php foreach ( $this->getOptions() as $option ): ?>
            <label>
            <input type="radio" class="radio" name="radio-group" value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' checked="checked"' ?>><?php echo __($option['label']) ?></input>
            </label>
            <?php endforeach ?>
    </div>
</li>

And I currently echo the entire value of the radio button with this line:

<?php echo $this->__('Would you recommend this product to a friend?') ?> <?php echo $this->getAnswer() ?>

The values of the radio buttons are
1. Yes
2. No

I want to check if value is Yes and if so echo 'Value is Yes'.

How can I achieve that?

Answer:1
 <li>
<label for="recommend_field"><?php echo $this->__('Would you recommend this product to a friend?') ?><span id='ans'></span></label>
<div class="input-box">
        <?php foreach ( $this->getOptions() as $option ): ?>
        <label>
        <input type="radio" class="radio" name="radio-group" value="<?php echo $option['value'] ?>"<?php if ($option['value'] == $value) echo ' checked="checked"' ?>><?php echo __($option['label']) ?></input>
        </label>
        <?php endforeach ?>
</div>
</li>

<script>
$(document).ready(function(){

$('input:radio[name=radio-group]:checked').change(function () {
        if (this.value == 'Yes') {
        $('#ans').html("Value is Yes");
        }
        else if (this.value == 'No') {
            $('#ans').html("Value is No");
        }



}); 


</script>    
Answer:2

I'm trying to add a class of "active" to the current slide in carouFredSel, and I can't get it to work. The closest I could get it to work was to add it on the first slide, using trigger("...

I'm trying to add a class of "active" to the current slide in carouFredSel, and I can't get it to work. The closest I could get it to work was to add it on the first slide, using trigger("...

I am using the following script to change the HTML5 required attribute of my input elements. I am wonder whether there is a way to modify this script to make it also work in Safari browsers, since ...

I am using the following script to change the HTML5 required attribute of my input elements. I am wonder whether there is a way to modify this script to make it also work in Safari browsers, since ...

  1. javascript html5 required attribute
  2. javascript html5 required
  3. html5 required javascript submit

This seems like it should work but doesn't. I'm not sure where the problem is - either I'm doing it wrong, or it's possible I have a syntax error. I just doesn't do anything. I'm trying to get the ...

This seems like it should work but doesn't. I'm not sure where the problem is - either I'm doing it wrong, or it's possible I have a syntax error. I just doesn't do anything. I'm trying to get the ...

  1. change image when hover
  2. change image when clicked
  3. change image when button is clicked android
  4. change image when button is clicked
  5. change image when scroll
  6. change image when clicked css
  7. change image when clicked android
  8. change image when hover javascript
  9. change image when mouse over
  10. change image when click jquery
  11. change image when mouse hover css
  12. change image when hover jquery
  13. change image when mouseover javascript
  14. image change when
  15. change image on button click javascript
  16. change image on hover codepen
  17. change image on linkedin post
  18. change image on mouseover
  19. change image on scroll jquery
  20. change image on hover css w3schools

Currently I have a Javascript function that uses I can hard code values in like - data: [1,4,7,9] However I wish to pass in an integer list to set the values from the code behind something like - C#...

Currently I have a Javascript function that uses I can hard code values in like - data: [1,4,7,9] However I wish to pass in an integer list to set the values from the code behind something like - C#...