Need to create Javascript function as bookmark which can be used to validate UI rules on any page opened

StackOverflow https://stackoverflow.com/questions/22983118

  •  01-07-2023
  •  | 
  •  

문제

I need to create a javascript function which will validate all UI checklist items I have for webpage I'm creating. So what I'm expecting is, all my team members should be able to validate their UI by just clicking on a bookmark in their chrome browser (or any browser)

How to achieve this? I have js function ready but it contains jquery as well.

도움이 되었습니까?

해결책

I'm able to achieve this. I created a bookmarklet

javascript:(function(){// my code here })();

Now this bookmarklet will run in context of my page, thus I'll have access to all js I have in my page and hence jquery as well.

What I did is, I call a function which resides in one of the js file in my page say:

validateUI(){
    validateRule1();
    validateRule2();
    validateRule3();
}

and in these functions I define my rules

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top