-
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 9 years, 8 months ago by
Satyakam.
-
This discussion was modified 9 years, 8 months ago by
Satyakam.
-
This discussion was modified 9 years, 8 months ago by
Satyakam.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Forcetalks.
-
This discussion was modified 8 years, 1 month ago by
Forcetalks.
-
This discussion was modified 9 years, 8 months ago by
Log In to reply.
Popular Salesforce Blogs
7 Qualities to Look for in a Salesforce Consulting Partner
Over the past few years, there has been a notable expansion in the Salesforce consulting partner network, which now encompasses individuals and global consulting agencies.…
The Perks of Getting a Salesforce Certification
Certifications are the way to go these days if one is looking to upskill and grow their career. Degrees are great, but a course certification…
Popular Salesforce Videos
Selling the Idea of Salesforce to Your Company - Make Your Own Experience
Salesforce can be a great asset for companies, but sometimes it can be tough to sell the idea of implementing it to decision-makers. In this…
What is Data Management in Salesforce Admin?
Data Loader is a tool to process bulk records and we can process five million records with the data loader.
How to Create Seamless Buying Experiences | Salesforce CPQ & B2B Commerce
B2B buying is evolving as buyers want a better, more personalized experience when shopping for their businesses. But Salesforce has that covered. Here are 4…