Completed

Javascript or JQuery to change class based on text value

Hi all,

I am a developer working on a node.js project, and am currently stuck in changing the class of a <label>TEXT</label> based on the TEXT Value.

The line of code is as follows:

<!-- Console Information -->

<div class="py-2">

<div class="d-flex align-items-center mb-2">

<ul class="list-inline mr-2 mb-0">

<li class="list-inline-item mr-0"><span class="metascore-primary score"><%= [login to view URL] %></span></li>

</ul><span class="text-muted text-uppercase text-xs mr-3">Metascore</span>

<ul class="list-inline mr-2 mb-0">

<li class="list-inline-item mr-0"><span class="ign">6.5</span></li>

</ul><span class="text-muted text-uppercase text-xs mr-3">IGNSCORE</span>

</div>

<p class="text-muted text-sm mb-1 console"><label class="console btn btn-sm btn-outline active"><%= [login to view URL] %></label></p>

<h3 class="h6 mb-1">

<div class="d-flex align-items-center"><a href="[login to view URL]" class="text-dark"><%= [login to view URL] %></a>

</div>

</h3><span class="text-muted">€<%= [login to view URL] %></span>

</div>

What I need:

I need the following class: <label class="console btn btn-sm btn-outline active"><%= [login to view URL] %></label>

to addClass and removeClass based on the following criteria:

1. If <%= [login to view URL] %> is the following Text Value: PS4 then the class "btn-outline" should be removed and the class "btn-outline-ps4" should be added to the label.

2. If <%= [login to view URL] %> is the following Text Value:XBOX then the class "btn-outline" should be removed and the class "btn-outline-xbox" should be added to the label.

3. If <%= [login to view URL] %> is the following Text Value: SWITCH then the class "btn-outline" should be removed and the class "btn-outline-switch" should be added to the label.

4. If <%= [login to view URL] %> is the following Text Value: PC then the class "btn-outline" should be removed and the class "btn-outline-pc" should be added to the label.

Skills: Javascript, HTML5, CSS, jQuery / Prototype, HTML

See more: javascript remove class, javascript change class style, javascript add class to div, javascript change css class property, dynamically change css class with javascript, javascript modify css class, javascript replace class with another, javascript get element by class, change dynamic text value, javascript change class background, text editor javascript jquery, swishmax change static text value, magento product options price change text value, change text value swish, javascript text value changes, javascript event change text input, dymanic change text value, flash change dynamic text value, change static text value flash, javascript onchange text value

About the Employer:
( 9 reviews ) Dublin, Ireland

Project ID: #21207069

Awarded to:

gamdurbhullar

i am ready to start wok right now ! ========================================== Let's start sir ? ==============

€40 EUR in 2 days
(134 Reviews)
6.9

13 freelancers are bidding on average €30 for this job

vranjan

Hi, I'm a full-stack developer with more than 10 years of work experience. Expert in BOTH Backend and Front-end Programming, PHP - OOP, MVC, REST API, HTML/CSS/JAVASCRIPT, Codeigniter, Laravel, Angular Js, React, Nod More

€50 EUR in 1 day
(180 Reviews)
7.0
kyleevert

Dear Client! I am very happy to see your project detail. I think it is just my project. :) As you can see in my profile, (my review: https://www.freelancer.com/u/kyleevert?w=f) I have much experience with your job. I t More

€19 EUR in 7 days
(15 Reviews)
5.7
psubramonian

I request you to contact me further in order to have a detailed discussion on your project related requirements. Please refer my portfolio below for more details. Waiting for your reply. My Portfolio: =========== - C More

€30 EUR in 7 days
(69 Reviews)
5.8
amitbanerjee2812

Dear Hiring Manager, I read your job description and I am confident that I can exceed your expectations. I am a professional programmer on PHP+MySQL+WordPress. Here is few recent work for website development : crm.n More

€19 EUR in 7 days
(23 Reviews)
5.2
romancoder204

How are you? I'm interested in your project. In my precious working years i have finished many succesful projets with 100% customer satisfaction. I am a full stack developer.( Angular,react,Vue,laravel,ionic framework More

€30 EUR in 7 days
(22 Reviews)
4.7
haiyang19890101

Hello! I have seen your project description. I will complete your project satisfactorily to your requirement. I can start work right away. I will be looking forward to hear from you. Thanks.

€19 EUR in 7 days
(21 Reviews)
3.9
codefounder0316

Hello. Dear employer. I am Guicai Y and I think I am glad to bid your post. I am javascript expert such as react js, angular js, vue js etc.. As you can see my profile I have made more project using react for clients. More

€30 EUR in 1 day
(4 Reviews)
4.0
jinjinwu

( ͡ᵔ ͜ʖ ͡ᵔ ) Hi, Dear. Thank you for your job posting. I read your description very carefully. I have experience in the PHP framework(Laravel and Codeigniter) and Wordpress development for 5 years long. And I majored i More

€50 EUR in 1 day
(6 Reviews)
3.5
JinTai

Dear Sir, Please accept this cover letter and the attached resume as my application for the role of MEAN Developer as advertised. I have 7 years of extensive experience on Web Development for both back-end and front-e More

€40 EUR in 7 days
(1 Review)
2.7
SeniorTop

Dear sir. When I was teenager I talented program. So I studied for 7 years with program. After then I have much experience for 6 years for developing several kind of program. I have developed Mobile application, Ecomm More

€15 EUR in 3 days
(1 Review)
0.4
viksmal92

Carefully, I have reviewed your job description and can surely help you out to develop an app as per your needs with quality work. As we have experience with developing apps for home services, auction, Real estate, E- More

€19 EUR in 7 days
(1 Review)
0.4
projectsTF

Hello, Yes, I have great experience in Node js . I understand your project requirements. Sure, I will fix your issues. I developed many projects in node js and angular js . I am waiting your good r More

€30 EUR in 1 day
(0 Reviews)
0.0