Check tag classes with watir?

前端 未结 2 1418
自闭症患者
自闭症患者 2021-01-19 03:35

I have a div that changes based on if the form was submitted correctly or not.
I wanted to know if it\'s possible to check a specific element for a class or not?

2条回答
  •  攒了一身酷
    2021-01-19 03:45

    You can do this with jquery (or not, jquery sintax is only more simple but with getelement you can do anything).

    This is an example that add class with a button click:

    $(".button").click(function(){  
    $("#myerrortest").attr("class",$("#myerrortest").attr("class")+" error");
    });
    

    this work also with $(".classname"). Hope it help

提交回复
热议问题