Cancelled

Complete a JavaScript statement to remove an array value on click

This is the existing statement:

<script>

var subs_array = [];

$('.sub').one('click', function(e){

[login to view URL]();

[login to view URL]( $(this).data('user-subscription') );

$('#sub').val(subs_array);

});

</script>

<!-- the html -->

<a href='#' class="sub" data-user-subscription='Magazine #1'>Subscribe to #1</a>

<a href='#' class="sub" data-user-subscription='Magazine #2'>Subscribe to #2</a>

<a href='#' class="sub" data-user-subscription='Magazine #3'>Subscribe to #3</a>

<input type="text" class="form-control" id="sub" size="50" value="" placeholder="Magazine #1, Magazine #2, Magazine #3">

The problem:

When you click on the link, it adds the value into the array and it is added into the input field but if you click again, it does not remove the value.

Modify the above statement so when you click on a link the first time, it adds the value into the array but if you click again, it removes the value.

Skills: Javascript, jQuery / Prototype

See more: remove javascript ctrl click, read array xml javascript, javascript tabs complete, javascript remove javascript code, remove javascript tags java, asp remove javascript, asp remove javascript code, remove javascript codes, remove javascript tags, java remove javascript tags, remove click activate remove control, remove javascript website, javascript calculator complete code, remove javascript, click drop menu javascript

About the Employer:
( 5 reviews ) Gold Coast, Australia

Project ID: #14795540

46 freelancers are bidding on average $17 for this job

superwanchiu

hello nice to meet you. i am very interested in your project i have rich experience for javascript . your project is very easy for me. i can complete your project in a short time. please send your message so that More

$15 AUD in 1 day
(24 Reviews)
0.0
krunalk529

I have 2.8 years of professional experience in both front-end and back-end technologies Front end: Angularjs, jquery, javascript, html, css, bootstrap Back end : java, spring , hibernate Database: mssql, mysql, mongodb

$16 AUD in 1 day
(0 Reviews)
0.0
lucks15022

I got the solution for this and I have the code ready with me. I will provide it to you the code in PM Could not provide here since this allows only 200 chars Relevant Skills and Experience I have lot of experience in More

$17 AUD in 1 day
(0 Reviews)
0.0
MisterWatson

edit: I now have a working solution. hit me up when you're ready to test it. theres actually a typo with the click event handler and your code does not have a function call to actually remove an existing value. I w More

$20 AUD in 0 days
(9 Reviews)
0.0
sibinx7

Sir, Please check this code ... remove one and use .on('click', function(){}) or simple .click(function(){}) // subs_array = $.grep(subs_array, function(item){ return item !== selectedValue ; });// Relevant Skills and More

$10 AUD in 1 day
(6 Reviews)
0.0
RaviVadaliya

Hello Sir, I have 5 year professional experience in IT industries. Below are my technical specialities. Asp.Net, jQuery, C#, Microsoft SQL Server, Web Service, WCF I will fixed your issue asap. Relevant Skills and Exp More

$15 AUD in 1 day
(0 Reviews)
0.0
diegofpr

A proposal has not yet been provided

$15 AUD in 0 days
(8 Reviews)
0.0
mmpatel009

Hello, Hope you are doing well, JSfiddler like is generated for you, please initiate message board so I can provide you Relevant Skills and Experience I have already corrected your script in local and availab More

$10 AUD in 1 day
(26 Reviews)
0.0
tlchung

I am a skilled js developer, I can make the js script remove the value when you click again. let discuss more via private message, thanks. Relevant Skills and Experience I am a skilled js developer, I can make the js More

$20 AUD in 1 day
(113 Reviews)
0.0
jimsproject102

hi sir this my demo, [login to view URL] Relevant Skills and Experience javascript,jquery,html Proposed Milestones $15 AUD - deliver script

$15 AUD in 1 day
(0 Reviews)
0.0
Weborchid

We are the team that visualize, pens down ideas, adds in the essential ingredient of creativity and imagination and cooks up that perfect dish called brand. Lets discuss in details.

$55 AUD in 1 day
(6 Reviews)
0.0
sachinraghav

I can do this project. I can start it right now. Message me for more details. Relevant Skills and Experience JavaScript, Jquery, html Proposed Milestones $10 AUD - Final Project

$10 AUD in 1 day
(2 Reviews)
0.0
alokrajiv

It is easy and, this being my first project on freelancer I have put a minimum bid. Why me? : Bronze Javascript Star holder on JS: [login to view URL] Relevant Skills and Experience Doing Ja More

$10 AUD in 1 day
(0 Reviews)
0.0
florinbacu

A proposal has not yet been provided

$15 AUD in 1 day
(30 Reviews)
0.0
celalaybar

Hello. I can help you. Relevant Skills and Experience I am good at JavaScript, HTML and CSS. Proposed Milestones $10 AUD - Done

$10 AUD in 0 days
(48 Reviews)
0.0
$20 AUD in 1 day
(0 Reviews)
0.0
navjot12

Hi , I have completed this project at my end.I am new at freelancing,dont know how exactaly write [login to view URL] my first bid. I have studied your requirement ,its very simple for me ,has been done. Thanks

$17 AUD in 1 day
(0 Reviews)
0.0
kofzx123

I am referring to the price of other freelancer, set an average price Relevant Skills and Experience Used to javascript, the operation of the array related knowledge Proposed Milestones $17 AUD - The first part More

$14 AUD in 1 day
(0 Reviews)
0.0
$17 AUD in 1 day
(0 Reviews)
0.0
BaNgan

Hi, We can check existence of the value and remove it in second click Relevant Skills and Experience Feel free to contact me via Skype: bangank36, my timezone is GMT+7. My resume website: [login to view URL] Regar More

$17 AUD in 1 day
(220 Reviews)
0.0