How to show only the labels in a div which has some data in it using jquery?

后端 未结 1 1620
小蘑菇
小蘑菇 2021-01-28 17:42

I am working with Spring Controller and JSP project. I have a jsp page in which I have one button which is Process and once I click that button, it shows me two rad

相关标签:
1条回答
  • 2021-01-28 18:17

    I believe that .hide() in jquery do not support the hide for <label>. So I would suggest to use <span> tag for your label instead the <label> tag

    <span id="status">Success= ${SUCCESS}</span>
    

    Then in your javascript, use .hide() and .show(), something similar as below:

    $(document).ready(function() {
    
     //hide label
    $('#status').hide();
    $('#error').hide();
    $('#data').hide();
    
    $('.btn-primary').click(function () {
        $('.btn-primary').removeClass('currentButton')
        $(this).addClass('currentButton')
        $('form').hide()
        $("#form_" + $(this).attr('id')).show();
    })
    
    $('#submit').click(function(){
    
        $('#status').show();
        $('#error').show();
        $('#data').show();
    
    });
    
    })
    

    an updated close enough demo

    0 讨论(0)
提交回复
热议问题