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
  •  | 
  •  

Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top