Reputation: 155
I have the following HTML:
<ul id="sort3" class="droptrue connectedSortable ui-sortable" data-update-url="http://localhost:5000/workorders/sort " data-wostatus-id="236">
<li class="workorder" id="workorder_37" style="">
<div class=" 3" data-maxsynch="E">
The following picks up the data wostatus_id:
$(this).data('wostatus-id')
But, I haven't figured out how to get the data maxsynch. I tried this:
$(this).find("div:first").data('maxsynch')
It gets a maxsynch value, but not from the first div.
Upvotes: 0
Views: 81
Reputation: 388326
Try
$(this).find("div[data-maxsynch]").data('maxsynch')
Demo: Fiddle
Upvotes: 0
Reputation: 12508
You could try one of the following:
1) $(this).find('div[data-maxsynch]').first().data('data-maxsynch');
2) $(this).find('div[data-maxsynch]').first().attr('data-maxsynch');
This locates the first nested div that contains the data-maxsynch data attribute and pulls its value.
Upvotes: 1