How must I compare array field in jquery?
I have a jquery script as:
- <script type="text/javascript">
- $(function () {
- $("#table").DataTable();
- $( "#table_content" ).sortable({
- items: "tr",
- cursor: 'move',
- opacity: 0.6,
- update: function() {
- sendOrderToServer();
- }
- });
- function sendOrderToServer() {
- var order_menu = [];
- $('tr.row1').each(function(index,element) {
- order_menu.push({
- id: $(this).attr('data_entry_id'),
- nameRoot: $(this).attr('data-id'),
- position:
- ????
- });
- });
- }
- });
- </script>
I want Position field will increase to 1 if nameRoot field == NULL. How should I do? Thank you very much :)