forum

home / developersection / forums / array of html input type=“button” in jquery?

Array of html input type=“button” in jquery?

David Miller 2466 03-Nov-2014

I have 3 Html input button in my web page.

<input id="Meal0" runat="server" type="button" class="btn-free arrayinput" />

<input id="Meal1" runat="server" type="button" class="btn-busy arrayinput" />

<input id="Meal2" runat="server" type="button" class="btn-primary arrayinput" />

now I want to have an array of 3 elements in my jquery function:

here is my all code:

 

        $("#btnNextWeek").click(function (e) {
            var MealsButton = $('.arrayinput');
            var Meals = s.split('!~!');
            for (var i = 0; i <= 2; i++) {
 
                MealsButton[i].css("color", "black");
                MealsButton[i].css("width", "200px");
                MealsButton[i].css("height", "60px");
 
                if (Attr[1] == "1") {
                    MealsButton[i].css("class", "btn-app btn-success btn arrayinput");
                    MealsButton[i].css("Buy", Attr[4] + ":" + Attr[3]);
                    MealsButton[i].val("خرید ژتون");
                }
 
                else if (Attr[2] == "1" && Attr[5] != "empty chip") {
                    MealsButton[i].css("class", "btn-app btn-free btn arrayinput");
                    MealsButton[i].css("DelBtn", Attr[5]);
                    if (Attr[6] != "empty chip") {
                        if (Attr[6] != "empty chip") {
                            MealsButton[i].val(Attr[6]);
 
                        }
 
                        else {
                            MealsButton[i].css("class", "btn-app btn-disable btn arrayinput");
 
                            if (Attr[6] != "empty chip") {
                                MealsButton[i].val(Attr[6]);
                            }
                            else {
                                MealsButton[i].val("");
                            }
                        }
                    }
 
                }
 
            }
        });

this error ocured :

0x800a01b6 - Microsoft JScript runtime error: Object doesn't support this property or method

how can i have an array of my html input elements and how can access to my array elements ?


Updated on 03-Nov-2014
David Miller

Other


Message
Can you answer this question?

Answer

1 Answers

Liked By