TransWikia.com

I'm not able to display users data after removing `display:none` property using jquery

Stack Overflow Asked by Sateesh Gollapudi on December 30, 2021

I want to display the data after submitting the form data. This is the code that I’ve written to get the form data…

    <div class="card" style="border: none;">
       <div class="card-body">
         <h3 class="text-center">For combined results</h3>
            <form method="post" name="filter-branch" id="csel">
              <div class="input-group">
                <select class="form-control mr-2" name="cbran" id="cselect">
                  <option value="">Select Branch</option>
                  <option value="cse" <?= ($cbranch_name == 'cse') ? 'selected' : '' ?>>CSE</option>
                  <option value="ece" <?= ($cbranch_name == 'ece') ? 'selected' : '' ?>>ECE</option>
                 <option value="civil" <?= ($cbranch_name == 'civil') ? 'selected' : '' ?>>CIVIL</option>
              <option value="mech" <?= ($cbranch_name == 'mech') ? 'selected' : '' ?>>MECHANICAL</option>
                 <option value="eee" <?= ($cbranch_name == 'eee') ? 'selected' : '' ?>>EEE</option>
               </select>
               <select class="form-control mr-2" name="cyear" id="select">
                <option value="">Select Year</option>
                <option value="1" <?= ($cyear_value == '1') ? 'selected' : '' ?>>1</option>
                <option value="2" <?= ($cyear_value == '2') ? 'selected' : '' ?>>2</option>
                <option value="3" <?= ($cyear_value == '3') ? 'selected' : '' ?>>3</option>
                <option value="4" <?= ($cyear_value == '4') ? 'selected' : '' ?>>4</option>                                
               </select>
<input type="submit" name="cfilter" id="cfilter" class="btn btn-outline-success" value="Filter" />
            </div>
        </form>
      </div>
</div>

<table class="table table-hover" id="filter-table" style="display:none;">
</table>

The problem I’m getting is when I’m trying to remove the style attribute it’s working fine but it displaying the headings of the table only when I gave return false after removing the style attribute. If I didn’t mention the return false statement the page is getting refresh and the selected values are also missing the data I’ve selected to display.

$('document').ready(function () {
        $('#csel').submit(function(){
           $('#filter-table').removeAttr('style');
           return false;
        });
});

enter image description here
This is how I’m getting the result when I mention return false.
Can anyone help me with this issue? Thank you in advance

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP