Jump to content

Please help with (jExpand)


chandler

Recommended Posts

I need to know How can I restrict the onclick to just the arrow? At the moment you can click anywhere in the row for it to expand.

 

(function($){
    $.fn.jExpand = function(){
        var element = this;

        $(element).find("tr:odd").addClass("odd");
        $(element).find("tr:not(.odd)").hide();
        $(element).find("tr:first-child").show();

        $(element).find("tr.odd").click(function() {
            $(this).next("tr").toggle();
        });
        
    }    
})(jQuery); 

 

        $(document).ready(function(){
            $("#report tr:odd").addClass("odd");
            $("#report tr:not(.odd)").hide();
            $("#report tr:first-child").show();
                
                $("#report tr.odd").click(function(){            
                $(this).next("tr").toggle();
                $(this).find(".arrow").toggleClass("up");
                 
            });
            //$("#report").jExpand();
        });

 

<table id="report">
        <tr>
            <th>Header Content</th>
        </tr>
        <tr>
            <td>Content</td>
            <td></td>
            <td></td>
            <td></td>
            <td><div class="arrow"></div></td>
        </tr>
        <tr>
            <td colspan="5">
                <h4>Additional information</h4>
                <ul>
                    <li></li>
                    <li></li>
                    <li></li>
                 </ul>   
            </td>
        </tr>
        </table>

 

Im a complete noob at this so much thanks for your help.

Link to comment
https://forums.phpfreaks.com/topic/216359-please-help-with-jexpand/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.