Tuesday, March 8, 2016

Get elements inside elementes jquary

 <div id="sortable-horizontal" style="width:100%">
            <img src="https://s-media-cache-ak0.pinimg.com/736x/88/70/72/8870729d814f13885f8dc25d9c90111e.jpg"  id="1"/>
            <img src="http://www.dailyfreepsd.com/wp-content/uploads/2013/06/Face-Expression-of-surprise-and-scare-120x120.png" id="2"/>
            <img src="https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcRxW0ma1d149zo2koacBtH7YUkGQMbVid6QsdhzKjxfwGg2XjQl" id="3"/>
            <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Face-kiss.svg/120px-Face-kiss.svg.png"id="4" />
            <img src="http://images.clipshrine.com/getimg/PngThumb-Sad-Face-3301.png" id="5"/>
        </div>

 function GetOrder() {
                    var liIds = $('#sortable-horizontal img').map(function (i, n) {
                        return $(n).attr('id');
                    }).get().join(',');

                    console.log(liIds);
                }

if class
                    var liIds = $('#sortable-horizontal .className').map(function (i, n) {
                        return $(n).attr('id');
                    }).get().join(',');

                    console.log(liIds);
                }

No comments:

Post a Comment

Sql server row level policy