Đã Hủy

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.

Kĩ năng: Javascript, jQuery / Prototype

Xem nhiều hơn: 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

Về Bên Thuê:
( 5 nhận xét ) Gold Coast, Australia

ID dự án: #14795540

46 freelancer đang chào giá trung bình $17 cho công việc này

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 Thêm

$15 AUD trong 1 ngày
(24 Nhận xét)
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 trong 1 ngày
(0 Nhận xét)
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 Thêm

$17 AUD trong 1 ngày
(0 Nhận xét)
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 Thêm

$20 AUD trong 0 ngày
(9 Nhận xét)
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 Thêm

$10 AUD trong 1 ngày
(6 Nhận xét)
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 Thêm

$15 AUD trong 1 ngày
(0 Nhận xét)
0.0
diegofpr

A proposal has not yet been provided

$15 AUD trong 0 ngày
(8 Nhận xét)
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 Thêm

$10 AUD trong 1 ngày
(26 Nhận xét)
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 Thêm

$20 AUD trong 1 ngày
(113 Nhận xét)
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 trong 1 ngày
(0 Nhận xét)
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 trong 1 ngày
(6 Nhận xét)
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 trong 1 ngày
(2 Nhận xét)
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 Thêm

$10 AUD trong 1 ngày
(0 Nhận xét)
0.0
florinbacu

A proposal has not yet been provided

$15 AUD trong 1 ngày
(30 Nhận xét)
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 trong 0 ngày
(48 Nhận xét)
0.0
$20 AUD trong 1 ngày
(0 Nhận xét)
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 trong 1 ngày
(0 Nhận xét)
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 Thêm

$14 AUD trong 1 ngày
(0 Nhận xét)
0.0
$17 AUD trong 1 ngày
(0 Nhận xét)
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 Thêm

$17 AUD trong 1 ngày
(220 Nhận xét)
0.0