Rookie here :) Need help on coding jQuery performing Dynamic search filter
I think the javascript is conflicting with jQuery because the checkboxes doesnt work but when I remove the script type (Bolded code) the check box functions. I have a search box that I created and the goal is to be able to dynamically search on the list and values of what the checkboxes shows.
Basically what this does on my page is when a check box is selected it will filter based on "my" which is their list. Now I need to add a search function that is based on "my" or "all" so it will search/filter. But I think my code for the search is wrong. Can you guys advise?
Here is the code for the interface.
Note: Not using HTML
- <apex:pageBlockSection title="Campaign Filters" collapsible="false" columns="4">
- <apex:pageBlockSectionItem >
- <input type="text" class="my-campaigns-search" /> Search Campaigns
- </apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
- <input type="radio" class="my-campaigns-radio" checked="true"/> My Campaigns
- </apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
- <input type="radio" class="all-campaigns-radio"/> All Campaigns
- </apex:pageBlockSectionItem>
- <apex:pageBlockSectionItem >
- <input type="checkbox" class="active-campaigns-checkbox" checked="true"/> Active Only
- </apex:pageBlockSectionItem>
- </apex:pageBlockSection>
Here is my code jQuery
- <script>
-
- <script type="text/javascript">
- function doSearch() {
- searchServer(
- document.getElementById("Name").value,
-
- );
- }
- $j = jQuery.noConflict();
-
- $j(document).ready(function(){
-
-
- $j('.my-campaigns-radio').change(function(){
- if($j('.my-campaigns-radio').is(':checked')) {
- $j('.all-campaigns-radio').removeAttr('checked');
- campaignFilter('my');
- }
- });
-
- $j('.all-campaigns-radio').change(function(){
- if($j('.all-campaigns-radio').is(':checked')) {
- $j('.my-campaigns-radio').removeAttr('checked');
- campaignFilter('all');
- }
- });
-
- $j('.active-campaigns-checkbox').change(function(){
- if($j('.active-campaigns-checkbox').is(':checked')) {
- campaignActiveFilter('active');
- } else {
- campaignActiveFilter('inactive');
- }
- });
- });
- </script>