0

HTML CODE LOOK LIKE:

<div class="style__ButtonList-kdrevq TBmPt"> <button class="sc-fjdhpX gKYhyw" style="margin-right: 5px; background-color: rgb(73, 101, 241);">Add Task</button> <button class="sc-fjdhpX bkXWNp" style="margin-right: 5px;">Download</button> <button class="sc-fjdhpX gKYhyw" style="color: rgb(255, 255, 255);"> </div> </div>

There are multiple buttons with the same class and type value. However, I need to click only 'Expand All' button using CSS selector I got the error message no element found.

1
  • 2
    Where is a button whose class name = Expand All? or what is it a id of control? Commented Dec 30, 2018 at 6:26

1 Answer 1

1

Your code is incomplete, So I am assuming here that the last button which has color: rgb(255, 255, 255); is the button you want to click. So you can use this.

$(document).ready(function() {
    var el = $('button[style^="color"]');
    if (el.length) {
        $(el).click(function() {
            alert("in place of this alert use your code");
        });
    }
});

or you can complete the code, or you can ask me if anything else is needed.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.