Create the nameSearch variable equal to the value entered in the nameSearch input box. Users can search for names in three ways: Matching an employee's last name if it contains the text string specified in nameSearch Matching an employee's last name if it begins with the nameSearch text string Matching an employee's last name only if it exactly matches the nameSearch text string. Richard has supplied you with code to add the selectedValue() method to the prototype of the HTMLSelectElement object class in order to return the value of the selected option in any selection list. Apply the selectedValue() method to the nameSearchType selection list to return the option selected by the user, storing the value in the nameSearchType variable. Create a switch-case structure for the following possible values of the nameSearchType
(this question is part 2 of 3 in a long problem)
JavaScript Commands
Create the nameSearch variable equal to the value entered in the nameSearch input box.
Users can search for names in three ways:
- Matching an employee's last name if it contains the text string specified in nameSearch
- Matching an employee's last name if it begins with the nameSearch text string
- Matching an employee's last name only if it exactly matches the nameSearch text string.
Richard has supplied you with code to add the selectedValue() method to the prototype of the HTMLSelectElement object class in order to return the value of the selected option in any selection list. Apply the selectedValue() method to the nameSearchType selection list to return the option selected by the user, storing the value in the nameSearchType variable.
Create a switch-case structure for the following possible values of the nameSearchType variable:
- If nameSearchType equals "contains", use the new RegExp() constructor to create a regular expression object named nameRegExp containing the regular expression nameSearch where nameSearch is the value of the nameSearch variable. Include the "i" flag with the regular expression object so that the regular expression matches lower or uppercase characters.
- If nameSearchType equals "beginsWith", set nameRegExp object to the regular expression ^nameSearch, once again with the "i" flag.
If nameSearchType equals "exact", set nameRegExp object to the regular expression ^nameSearch$ with the "i" flag to allow for upper- and lower-case matches.
cc_staff.js (add code to this file)
![ADVOCACY
COMPLIANCE DEVELOPMENT
COMMUNITY
NEWS
SUPPORT
NEWSLETTER
CRESCENT CREDIT UNION LEAGUE
Staff Directory
Last Name
M
Begins With
Department
Position
director
Contains
search
3 records found
PHOTO
NAME
DEPARTMENT
PO SITION
E-MAIL
PHONE
Betty Moran
Professional Development
Director of Meetings & Conferences
betty.moran@ccul.example.com
B0D-555-6506
Douglas Moorman
Audit Services
Director of Comprehensive Audits
douglaz.moorman@ccul.example.com
B00-555-9019
Steven Miller
PR and Communications
Director of Communications
steven-millen@ccul.example.com
B0D-555-5505
ADVOCACY
COMPLIANCE
DEVELOPMENT
COMMUNITY
Deadlines & Policies
Regulatory Deadlines
Compliance FAQ
Fraud & Risk Resources
Annual Meeting
Leadership Institute
Webinars
Grass Roots Action
Chapters
Asset Groups
CCUL History
Membership Info
Social Media
Federal Issues
Research & Resources
Regulatory Report
Training
Compliance Group
Certification
CCUL Magazine
Call Center
Events
Advocacy Team
Board of Directors
Crescent Credit Union League © 2018 All Rights Reserved](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fe7914562-dbac-47cb-b9fb-a5ea652c9da8%2Fe97d03d9-c947-4b8e-8290-10d397145fb6%2F0lltjg_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Computer Networking: A Top-Down Approach (7th Edi…](https://www.bartleby.com/isbn_cover_images/9780133594140/9780133594140_smallCoverImage.gif)
![Computer Organization and Design MIPS Edition, Fi…](https://www.bartleby.com/isbn_cover_images/9780124077263/9780124077263_smallCoverImage.gif)
![Network+ Guide to Networks (MindTap Course List)](https://www.bartleby.com/isbn_cover_images/9781337569330/9781337569330_smallCoverImage.gif)
![Concepts of Database Management](https://www.bartleby.com/isbn_cover_images/9781337093422/9781337093422_smallCoverImage.gif)
![Prelude to Programming](https://www.bartleby.com/isbn_cover_images/9780133750423/9780133750423_smallCoverImage.jpg)
![Sc Business Data Communications and Networking, T…](https://www.bartleby.com/isbn_cover_images/9781119368830/9781119368830_smallCoverImage.gif)