Jump to content

Trying to disable asp Buttons by class name with Javascript


Recommended Posts

Hello all!

I have two asp buttons that are in the header and footer of an asp DataList, and I am trying to use javascript to disable them based off a bool variable that is set in the codebehind. Because these buttons are in the datalist I thought it would be easier to use class names to find them. I have had no luck in getting the buttons disabled though. The following is what I have come up with and attempted.

function SetButtonStatus() {

        var bb = document.getElementsByClassName('Buttonsubmit');
        for (var i = 0; i < bb.length; i++) {

            bb.disabled = "<%=!isQtyValid%>";
        }
    }

In the browser I am able to see that the bool variable isQtyValid is there. Is my problem with trying to getElementsByClassName? I did a check to see the length of what bb is and it returns 2 like I thought it would. Or is my problem that bb is a generic object and needs to be cast as a button?

I am no pro when it comes to javascript, that is a for sure haha, but I know some basics, and with the help of google I am usually able to piece together something that works, but this time I have not been able to find much resources pertaining to my particular situation.

Thanks for your time! Any tips or pointers are appreciated! If you think you need more info just let me know and I will do my best to get it to you.

Link to comment
Share on other sites

  • Moderators

Why are you asking a Javascript question in a forum dedicated to AutoIt? >_

Edited by JLogan3o13

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...