-
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 7 years, 11 months ago by Satyakam.
- This discussion was modified 7 years, 11 months ago by Satyakam.
- This discussion was modified 7 years, 11 months ago by Satyakam.
- This discussion was modified 7 years, 11 months ago by Forcetalks.
- This discussion was modified 7 years, 11 months ago by Forcetalks.
- This discussion was modified 7 years, 11 months ago by Forcetalks.
- This discussion was modified 7 years, 11 months ago by Forcetalks.
- This discussion was modified 7 years, 11 months ago by Forcetalks.
- This discussion was modified 7 years, 11 months ago by Forcetalks.
- This discussion was modified 7 years, 11 months ago by Forcetalks.
- This discussion was modified 7 years, 11 months ago by Forcetalks.
- This discussion was modified 6 years, 4 months ago by Forcetalks.
Log In to reply.
Popular Salesforce Blogs
Learn All About Data Modeling in Salesforce
Introduction A data model is a way to store/represent data in a database consisting of tables with columns and rows. In Salesforce, data is stored…
How to Digitize Pharmaceutical Production with Salesforce
Following the pandemic, the pharmaceutical industry has been expanding and the companies are competing with each other, struggling to take a lead in the market.…
Checklist to Hire the Best Certified Salesforce Developer for Business
Salesforce is a powerful Customer Relationship Management (CRM) platform that businesses—irrespective of the industry or domain leverage to manage their customer data and interactions. With…
Popular Salesforce Videos
5 Tips: How Events Can Help You Drive Value for Your Business | Salesforce on Salesforce
Events are at the heart of every major launch moment and announcement. They offer opportunities to connect with customers, providing experiences that grow loyalty. And…
Creating leads using Amazon Alexa with salesforce.
Amazon EchoAmazon Echo is a voice command device with functions like question answering, playing music and controlling smart devices. Echo connects to Alexa which is…
How to Find Volunteer Work as a Salesforce Professional
In this video, Brad discusses how to generate work experience through volunteer jobs. These jobs allow for new professionals to gain Salesforce specific, applicable knowledge…