changing href attribute of a link with an input radio button
Hi guys,
I'm trying to change a href value of a button, but it's not working. I'm using jquery-1.8.0 and created a function like this:
- $('input[name=radio-group-1]:radio').change(function() {
- if ($(this).val() == 'no') {
- $('.btn[href=http://www.google.com]').attr("href","http://www.yahoo.com");
- }
- });
HTML:
- <label for="yes">Yes</label>
- <input type="radio" name="radio-group-1" value="yes" />
- <label for="no">No</label>
- <input type="radio" name="radio-group-1" value="no" />
- <a href="http://www.google.com" class="btn">next</a>
Hope someone can point me in the right direction. Thanks in advance!