-
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, 1 month ago by Satyakam.
- This discussion was modified 8 years, 1 month ago by Satyakam.
- This discussion was modified 8 years, 1 month ago by Satyakam.
- This discussion was modified 8 years ago by Forcetalks.
- This discussion was modified 8 years ago by Forcetalks.
- This discussion was modified 8 years ago by Forcetalks.
- This discussion was modified 8 years ago by Forcetalks.
- This discussion was modified 8 years ago by Forcetalks.
- This discussion was modified 8 years ago by Forcetalks.
- This discussion was modified 8 years ago by Forcetalks.
- This discussion was modified 8 years ago by Forcetalks.
- This discussion was modified 6 years, 5 months ago by Forcetalks.
Log In to reply.
Popular Salesforce Blogs
VIP Spotlight - Meet Shonnah Hughes | Salesforce MVP
Many of us know the awkwardness of trying to come up with a fun fact at the beginning of a new class or job. We…
What is The Use of Test Class in Salesforce | Developer Guide
Test Class Testing is an important part of the Software Development Life Cycle (SDLC). Before moving the code in production, Salesforce ensures that your code…
What is Pardot API in Salesforce?
Pardot is a powerful marketing automation tool that is used by businesses of all sizes to drive growth and achieve their marketing goals. Pardot provides…
Popular Salesforce Videos
Creation Of An App In Salesforce | Salesforce Development Tutorial
Creation of an app in Salesforce. This video will cover the following points - App Creation Get to know why an app is created. Configuration…
5 Salesforce Developer Interview Red Flags That’ll Likely Get You Rejected
These are some common interview red flags that’ll likely get you rejected for that dream Salesforce developer job. Start prepping accordingly! Watch this video and…
How to Connect Salesforce Billing Payment Gateways (COMPILATION)
In this compilation, we’ll show you what you need to know about using your preferred payment gateway with Salesforce Billing + CPQ - like how…