-
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, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Forcetalks.
-
This discussion was modified 8 years, 10 months ago by
Forcetalks.
-
This discussion was modified 10 years, 5 months ago by
Log In to reply.
Popular Salesforce Blogs
All You Need to Know About Salesforce Integrations
Integration In Salesforce, integration refers to the process of connecting and combining different systems or applications to enable the exchange of data and functionality. It…
Visualforce in Lightning Experience | Salesforce Guide
Although Lightning Experience introduces a whole new user interface to your Salesforce organisation, your Visualforce apps will continue to function. Many Visualforce pages operate in…
All About Data Modelling in Salesforce
In this blog, I am going to explain the topic of data modelling, fields, and object relationships. Let’s begin with: Database It is an organized…
Popular Salesforce Videos
Kanban View and Personalisation | Salesforce Training
In this short video, we will show you the Kanban view in Salesforce Lightning and how it can be personalized. Check out this amazing and…
How Much Time to Give to Salesforce Preparation?
Wondering how much time to give for Salesforce preparation? Watch this video it explains distinctly how much time you need to learn. If you have…
5 Strategies to Get a Salesforce Job with No Experience
If you have questions like how to jump start your Salesforce career as a freshers? Or what should be your approach to start Salesforce career?…