-
Add a value in Datalist using Jquery
In a scenario there is a Datalist and there are some Datalist values in that Datalist. When you will click on any Datalist value that value will be invisible from that Datalist and should be shown on vf page with a checkbox and when you will check that checkbox that value will be invisible from page and again should be shown in datalist. I want to solve this problem using JQuery. I have gone through following code but not getting complete solution. Can i get any solution..?
function checkboxClick(obj){
var id = $(obj).attr("id");
if($('#' + id).is(":checked")){
$(obj).closest("tr").remove();
}
}
$(document).ready(function(){
var a;
var idCounter=1;
$(document).on('click', '#ddlList', function () {
a = $('#ddlList option:selected').text();
$('#ddlList option:selected').remove();
if(a != ''){
var b = $('#demo').append('<tr>
<td><input type="checkbox" onclick="checkboxClick(this)" id="ck_'+idCounter+'"/></td>
<td class="newLine">'+a+'</td>
</tr>
');
idCounter++;
}
});
});----------------------
<select id="ddlList">
<option value="0">None</option>
<option value="1">ASP.NET</option>
<option value="2">C#</option>
<option value="3">VB.NET</option>
<option value="4">HTML</option>
<option value="5">jQuery</option>
</select>
<table id="demo">
<tbody>
<tr>
<td></td>
</tr>
</tbody>
</table>-
This discussion was modified 8 years, 10 months ago by
Satyakam.
-
This discussion was modified 8 years, 10 months ago by
Satyakam.
-
This discussion was modified 8 years, 10 months ago by
Satyakam.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 7 years, 3 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Log In to reply.
Popular Salesforce Blogs
![](https://images.forcetalks.com/wp-content/uploads/2024/06/21090515/sa_171896069814449322_5464026-1024x683.jpg)
How Can Salesforce B2B E-Commerce Boost Your Business Growth?
In today's competitive digital marketplace, businesses are continually seeking innovative ways to enhance their growth. One powerful tool that stands out is Salesforce B2B E-Commerce.…
![](https://images.forcetalks.com/wp-content/uploads/2021/08/12192308/sa_1628796182DevOps%20for%20Salesforce%20Blog%20%20for%20Forcetalks-1024x539.png)
DevOps for the Salesforce Ecosystem
The following is a summary of the information covered in the webinar: DevOps for the Salesforce Ecosystem. Modern IT Transformation Overwhelmingly, organizations are needing to…
![](https://images.forcetalks.com/wp-content/uploads/2020/04/16110635/salesforce-einstein-for-marketing.png)
The Role of Salesforce Einstein in Marketing, Sales, and Services
Salesforce Einstein is an Artificial Intelligence technology launched for the Salesforce Customer Success Platform. With Salesforce Artificial Intelligence, you can increase the potential of marketing,…
Popular Salesforce Videos
Leads & Opportunities for Lightning Experience - Create and Convert Leads
Learning Objectives After completing this unit, you’ll be able to: Update a record’s stage or status using Path. Update records in the Kanban view. Use…
Salesforce Development and Career Opportunities
Salesforce is the world’s #1 customer relationship management (CRM) platform. Salesforce allows sales reps to see everything about a customer in one place and provide…
Salesforce Sales Cloud Implementation
There are many things to take into consideration when developing and deploying a Salesforce Sales Cloud implementation that will take your business to the next…