Neither if nor else is triggering

javascript, jquery

Solution

`.setAttribute()` isn't a valid jQuery method. Use `.attr()`.

$(document).ready(function() {
    $('#search_option').change(function() {
        alert('changed');
        if( $('#search_option').val() == "wiki" ) {
            $('#search_form').attr('action', "http://www.wikipedia.org/search-redirect.php");
            $('#search_bar').attr('name', "search");
            alert('Got inside wiki');
        } else {
            $('#search_form').attr('action', "http://www.google.com/search");
            $('#search_bar').attr('name', "q");
            alert('Got inside google');
        }
    });
});​

Problem

Here is my statement: ``` $(document).ready(function() { $('#search_option').change(function() { alert('changed'); if( $('#search_option').val() == "wiki" ) { $('#search_form').setAttribute('action', "http://www.wikipedia.org/search-redirect.php"); $('#search_bar').setAttribute('name', "search"); alert('Got inside wiki'); } else { $('#search_form').setAttribute('action', "http://www.google.com/search"); $('#search_bar').setAttribute('name', "q"); alert('Got inside google'); } }); }); ``` Neither of the 'got inside' alerts are triggering, meaning that neither of them are running, correct? I can not seem to figure out why neither parts of the if statement are running, at least one should be

Original source