-
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, 9 months ago by Satyakam.
- This discussion was modified 8 years, 9 months ago by Satyakam.
- This discussion was modified 8 years, 9 months ago by Satyakam.
- This discussion was modified 8 years, 8 months ago by Forcetalks.
- This discussion was modified 8 years, 8 months ago by Forcetalks.
- This discussion was modified 8 years, 8 months ago by Forcetalks.
- This discussion was modified 8 years, 8 months ago by Forcetalks.
- This discussion was modified 8 years, 8 months ago by Forcetalks.
- This discussion was modified 8 years, 8 months ago by Forcetalks.
- This discussion was modified 8 years, 8 months ago by Forcetalks.
- This discussion was modified 8 years, 8 months ago by Forcetalks.
- This discussion was modified 7 years, 1 month ago by Forcetalks.
Log In to reply.
Popular Salesforce Blogs
7 Reasons You Should Consider Salesforce CTI Integration
Salesforce CTI integration is the process of integrating your Salesforce account with your customer relationship management (CRM) system. This allows you to manage your customer…
What is Case Automation Tool in Salesforce
Let’s Discuss the Main Case Automation Tool Queue: With the help of Queue, It organizes the support team burden by creating a list from which…
6 Ways To Utilize Salesforce Sales Cloud To Its Fullest
Salesforce holds the top spot in the industry when it comes to streamlining business processes. Having been around for over 20 years now, Salesforce has…
Popular Salesforce Videos
Quick Text in Salesforce | Service Cloud | Salesforce Tutorial
In this video, we will talk about what is Quick text and how to implement those Quick texts inside Salesforce. Watch the video and let…
Introduction To Salesforce Integration
This video is about a basic intro to Salesforce Integration What is integration? Types Of integration Benefits of Salesforce integration Best Practices for successful integration…
Tour to the Dreamforce National Park!
What happened at Dreamforce? #ArtificialIntelligence was a consistent theme, a lot more about Commerce, about Customer 360, etc Missed Dreamforce? Then, take a tour of…