Update HTML H4 tag using jQuery

javascript, jquery

Solution

Check out the following fiddle.

http://jsfiddle.net/JBjXN/

<div class="radio-line" id="radio-manager">
    <input type="radio" id="rad-400" name="radio-manager" value="No" data-text="Employees" />
</div>

<h4 class="manager">Manager</h4>

$('.radio-line').on('click', 'input[type="radio"]', changeText);

function changeText(e) {
    $('.manager').text($(e.currentTarget).data('text'));
}​

Problem

I am having trouble changing the "text" between an HTML tag using jQuery. When someone clicks on a "radio button", the text should be updated in a certain HTML element. Here is my HTML: ``` <div class="radio-line" id="radio-manager"> <input type="radio" id="rad-400" name="radio-manager" value="No" /> </div> ``` HTML to be updated on radio check: ``` <h4 class="manager">Manager</h4> ``` When someone clicks on the radio above, the "Manager" text should become "Employees". I tried some jQuery code but cannot quite figure it out.

Original source