Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

125
Views
Popup opening when you click on the text in the menu

I have a ready popup. But I only want it to open when I click on the "Send my policy to my email address" item in the menu. How can I do it?

<AS.Menu
  id="long-menu"
  MenuListProps={{
    'aria-labelledby': 'long-button',
  }}
  anchorEl={anchorEl}
  open={open}
  onClose={handleClose}
>
  {[
    'View PDF',  // Menu item
    'Send my policy to my email address', // Menu item
    'Cancel my policy', // Menu item
    ].map((option) => (
    <AS.MenuItem key={option} onClick={handleClose}>
      {option}
    </AS.MenuItem>
  ))}
</AS.Menu>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

One of the options would be to pass the clicked option to the handleClose method, something like the below:

<AS.Menu
  id="long-menu"
  MenuListProps={{
    'aria-labelledby': 'long-button',
  }}
  anchorEl={anchorEl}
  open={open}
  onClose={handleClose}
>
  {[
    'View PDF',  // Menu item
    'Send my policy to my email address', // Menu item
    'Cancel my policy', // Menu item
    ].map((option) => (
    <AS.MenuItem key={option} onClick={() => handleClose(option)}>
      {option}
    </AS.MenuItem>
  ))}
</AS.Menu>

Then, In the handleClose method you can validate whether the clicked option was the one you want:

const handleClose = (option) => {
  if (option === 'Send my policy to my email address') showPopup();
}
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!