Hi,

I'm trying change all instances of "document.getElementById()" with
the jQuery's DOM traversal syntax, however it breaks it everytime.

A simple example is this function:

    rm: function(){
    var m = document.getElementById('discountMonth');
    if(m)
        m.selectedIndex = 0;
    }

If I change "document.getElementById('discountMonth');" to "$
('#discountMonth');"  or any variation of that it breaks.(I tried
single and double quotes as well as attempting to get the element by
class and so forth with no luck).

The HTML looks like this <select onchange="$.bots.rd();return false;"
id="discountMonth" name="deals[discountMonth]"
class="input_deals_dropdown"><option value=""/></select>.

The more troublesome issue is with a function like this

    rd: function (){
    var ds = new Array('checkInDate-Deal', 'checkOutDate-Deal');
    $(ds).each(function(i){
        el = document.getElementById(ds[i]);
        if(el)
            el.value = 'mm/dd/yyyy';
    });
    }, ...

With the HTML looking like "<input type="text" onblur="$.bots.rm
();return false;" id="checkOutDate-Deal" value="mm/dd/yyyy"
name="checkOutDate" class="input_deals"/>

Any help understanding jQuery's DOM traversal especially with regard
to array iterations would be much appreciated, thanks.

Reply via email to