-
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
![Salesforce Evergreen](https://images.forcetalks.com/wp-content/uploads/2020/04/23140522/Salesforce-Evergreen-1024x512.jpg)
Salesforce Evergreen | Scale Up Your Cloud Productivity With Ease
The trend of Cloud-based services has forever changed the way we develop and deploy applications in the server. In spite of all the benefits that the Salesforce…
![change sets in salesforce](https://images.forcetalks.com/wp-content/uploads/2020/07/23180906/change-sets-in-salesforce.png)
Best Practices for Change Sets in Salesforce
These are some of Best Practices for Change Sets:- Deploy each dependent components Make sure every outbound change set contains all mutually beneficial parts that…
![](https://images.forcetalks.com/wp-content/uploads/2024/05/16062057/sa_1715840031blogs%20banner%2040-1024x586.jpg)
Hiring the Best Salesforce Consultants: What to Look for?
Today's businesses constantly seek innovative ways to streamline operations and improve customer service. Salesforce is a leading CRM (customer relationship management) platform in the market…
Popular Salesforce Videos
How to Set Up Salesforce Customer Community
Step by Step Salesforce tutorial for quickly setting up a Customer Community with Customer Service (Napili) Template.
Basics of Salesforce Flow in 15 minutes
In this video, Jitendra Zaa gives a detailed overview of the basics of Salesforce Flow in just 15 minutes. He covers everything from how to…
Salesforce Trailhead - Control Access to Fields
In this video, Your Coding Buddy covers how to control access to fields in Salesforce Trailhead. He explains that this is important for keeping data…