-
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 10 years, 5 months ago by
Satyakam.
-
This discussion was modified 10 years, 5 months ago by
Satyakam.
-
This discussion was modified 10 years, 5 months ago by
Satyakam.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 10 years, 4 months ago by
Forcetalks.
-
This discussion was modified 8 years, 9 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Log In to reply.
Popular Salesforce Blogs
Resolution of Managed Packages - Salesforce DX Developer Guide
Working with Salesforce DX for the resolution of managed packages: First, we create an org and enable the DX version in it that is DEVHUB.…
The Role of Salesforce Consultants in Digital Transformation: Key Insights for 2024
As businesses navigate the evolving landscape of technology, digital transformation has become a critical priority for staying competitive and relevant. Salesforce, a leading customer relationship…
Popular Salesforce Videos
Lead Together with Salesforce | Salesforce Partners
Learn more about the Equality Programs and initiatives that are available to Salesforce Partners, including the Salesforce Talent Alliance. Watch this video to learn all…
TrailheaDX '18 Opening Keynote - Part 3: Connect Every Experience
Salesforce TrailheaDX ’18 Opening Keynote – Part 1: Create Connected Customer Experiences TrailheaDX ’18 Opening Keynote – Part 2: Salesforce Platform Salesforce TrailheaDX ’18 Opening…
Introduction to Flow in Salesforce
This informative video on flows in Salesforce contains the following topics:- 00:00 - Introduction 02:14 - Agenda 02:49 - Flow is Automation 03:35 - The…