0

Hello,
I have an event ('show' & 'click') bounded to the element to make it scrollable using the jquery '.on' method but when I try to bind another event on click like below the alert does not show up -

$('.elem').on('show', function(){//some code here}).on('click', function(){alert($(this).text())});

what I am actually trying to do is, leave this 'tr' hidden initially and while pn click of it make it visible.
But its not happening clearly.Thank you

2
Contributors
2
Replies
26
Views
3 Years
Discussion Span
Last Post by network18
0

Do you have a more complete code sample that we can work with?

what I am actually trying to do is, leave this 'tr' hidden initially and while pn click of it make it visible.

Ok so why not initially set the CSS display:none on this tr element, and just do something like this...

$('elem').click(function(){
   $('tr').show();
});
0

Thank you for your reply.
I am doing the similar thing like hiding the element at first and then trying to show it on click or the scrollable event. but if the element is hidden initially they jquery code above, set up on '.on' dont work. It also leaves empty space between two rows.

<script>
$('.accordion .collapse')
                        .on('show', function() {
//                                alert($(this).attr('id')+'>>');
//                                console.log($(this).attr('id'));
//                                $($(this).attr('id')).attr('display') = 'table-row';

                            $(this).prev('.accordion-heading').find('.accordion-toggle').addClass('in');

//                                    css('background-color', 'red');
//                                    .find('row_collapse0').addClass('disp');
                        })
                        .on('click', function(){alert('test')})
                        .on('hide', function() {
</script>

<tr id="row_collapse'.$i.'" style="display:inline; margin-top:0px; margin-bottom:0px; padding-top:0px; padding-bottom:0px; border:0px solid red;">
                            <td colspan="9" style="margin-left:25px; max-height:2px;" >
                                <div id="collapse'.$i.'" class="accordion-body collapse">
                                <div id=" class="accordion-inner">

Edited by network18: appreciation for response

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.