-
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 10 years, 1 month ago by
Satyakam.
-
This discussion was modified 10 years, 1 month ago by
Satyakam.
-
This discussion was modified 10 years, 1 month ago by
Satyakam.
-
This discussion was modified 10 years ago by
Forcetalks.
-
This discussion was modified 10 years ago by
Forcetalks.
-
This discussion was modified 10 years ago by
Forcetalks.
-
This discussion was modified 10 years ago by
Forcetalks.
-
This discussion was modified 10 years ago by
Forcetalks.
-
This discussion was modified 10 years ago by
Forcetalks.
-
This discussion was modified 10 years ago by
Forcetalks.
-
This discussion was modified 10 years ago by
Forcetalks.
-
This discussion was modified 8 years, 5 months ago by
Forcetalks.
-
This discussion was modified 10 years, 1 month ago by
Log In to reply.
Popular Salesforce Blogs
Salesforce Commerce Cloud for E-Commerce
What Is Commerce Cloud? Commerce Cloud is one of the eight product clouds that make up the Salesforce Intelligent Customer Success Platform. Along with Sales…
How To Create a Custom Salesforce Communities Login and Landing Page (Spring 2017)
1.) First go to Customize -> Communities -> Settings and create a domain for your community. I am using ‘SINGH2050’. 2.) Once the Domain Name…
How Can Hiring A Salesforce Consultant Increase Your Business ROI?
What does Return on Investment mean? Return on Investment (ROI) is a measurement of performance that helps in calculating the efficiency of an investment. With…
Popular Salesforce Videos
Topics to Master to Crack Your Salesforce Administrator Certification Exam
If you're preparing for your Salesforce Administrator Certification and wondering there's a lot that you need to cover from the study material provided by Salesforce.…
How to Create Contact in Salesforce | Salesforce Contacts | Salesforce Tutorial
Contact in Salesforce represents the individual people associated with the business accounts in your organization or Contact records are used for individuals to store personal…
Salesforce Einstein – CRM Stepping Into The World Of AI
We belong to a hyper-connected world these days where each and every step we take is an onslaught of data. So for this world what…