-
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, 6 months ago by
Satyakam.
-
This discussion was modified 10 years, 6 months ago by
Satyakam.
-
This discussion was modified 10 years, 6 months ago by
Satyakam.
-
This discussion was modified 10 years, 6 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Forcetalks.
-
This discussion was modified 8 years, 11 months ago by
Forcetalks.
-
This discussion was modified 10 years, 6 months ago by
Log In to reply.
Popular Salesforce Blogs
How To Implement JQuery AutoComplete
JQuery Autocomplete enhances the UI functionality of visualforce page, when a user types in a field it quickly find and select from a pre-populated list…
10 Essential B2B Salesforce AppExchange Apps
The Salesforce AppExchange is a great place to find essential apps to operate within the Salesforce platform. These apps provide critical features that help you…
Salesforce Product : Service Cloud
Salesforce Product : Service Cloud The Service Cloud Platform or a customer support platform gives your agents power to deliver service that’s as instant and…
Popular Salesforce Videos
Transition to Salesforce Lightning Experience
Transition to Salesforce Lightning Experience for Overall Navigation, Global Search, Home Page, Accounts, Leads and Opportunities. This video walks you through the recommended process, including…
What are Queues in Salesforce? | How to create queues and assign records to it in Salesforce?
This video explains Queues in Salesforce by dividing this topic into 5 basic points, which are: 1. What purpose do queues solve? 2. What are…
How to Set Up Salesforce Knowledge?
Watch this video to learn how to set up Salesforce Knowledge so you can help your team more easily find answers to common customer requests.…