Created
January 3, 2019 17:05
-
-
Save grekodev/02a8c2defe8e4cdf4bfb461a6287be51 to your computer and use it in GitHub Desktop.
Remover de un array un elemento objeto
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var formas_pago = JSON.parse('<?php echo json_encode($forma_pagos); ?>'); | |
| function removeSelectPago(noclick) { | |
| var seleindex; | |
| $('.select_formapago').on('change', (e)=>{ | |
| var option_value = parseInt(e.target.value); | |
| if (option_value !== 1 && noclick){ | |
| console.log(option_value) | |
| seleindex = formas_pago.map(function(e) { return e.id; }).indexOf(option_value); | |
| console.log(formas_pago); | |
| formas_pago.splice(seleindex, 1); | |
| }else if(option_value === 1 && noclick){ | |
| seleindex = formas_pago.map(function(e) { return e.id; }).indexOf(1); | |
| formas_pago.splice(seleindex, 1); | |
| } | |
| }) | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment