-
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 Flows - What You Need to Know
Businesses strive to grow bigger and better, but the amount of complex processes becomes trickier to manage without a reliable system that can streamline multiple…
Popular Salesforce Videos
Why To Sell Your SAAS Application On Salesforce AppExchange ?
From unparalleled market reach to seamless integration and trusted security, explore the benefits that await SAAS entrepreneurs on Salesforce AppExchange. Watch our latest webinar to…
Extend your Reporting Strategy with AppExchange | Reports & Dashboards | Salesforce
This Salesforce Tutorial is ideal for both beginners as well as professionals who want to master Salesforce Cloud. Below are the topics covered in this…
Modern App Development On Salesforce - Apex Testing
In this series, you will explore Modern App Development on the Salesforce platform, including Heroku. The live hands-on sessions will take you through the journey…