Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel , How can I increment and decrement value with unique id

function incrementValue(e)
    {
        // use the quantity field's DOM position relative to the button that was clicked
        const qty = e.target.parentNode.parentNode.querySelector("input.req.amnt");
        var value = parseInt(qty.value, 10);
        value = isNaN(value) ? 0 : value;
        value++;
        qty.value = value;
    }


    function decrementValue(e)
    {
        const qty = e.target.parentNode.parentNode.querySelector("input.req.amnt");
        var value = parseInt(qty.value, 10);
        value = isNaN(value) ? 0 : value;

        value--;
        if(value == -1) {
            value = 0;
        }
        qty.value = value;
    }
@forelse($allproduct as $key=>$data)
                            <tr>
                                <td data-label="@lang('Date')">
                                     <div class="quantity col-md-8" style="display:flex; ">
                                          <input type="text" value="" class="form-control req amnt display-inline" min="0">
                                       <div class="quantity-nav">
                                          <div class="quantity-button quantity-up qty" onclick="incrementValue(event)">+</div>
                                          <div class="quantity-button quantity-down qty" onclick="decrementValue(event)">-</div>
                                       </div>

                                    </div>
                                 </td>
                            </tr>
          @endforelse
Comment

PREVIOUS NEXT
Code Example
Php :: export data to excel in codeigniter using phpexcel 
Php :: laravel foreach localstorage 
Php :: what is the fee/commission charge for payoneer 
Php :: join in php 
Php :: php doctrine findby greater than 
Php :: Drupal get node id from view 
Php :: php slim inspect request method 
Php :: cake php 2.x group 
Php :: php discord webhook sender 
Php :: how we generate a single column migration in laravel 
Php :: http://www.endmemo.com/program/R/vector.php 
Php :: php isset tableau 
Php :: laravel download file from storage with progress bar 
Php :: upload image to backend (see rest of the link) 
Php :: str_ireplace — Case-insensitive version 
Php :: cURL error 60 : SSL certificate in Larvel in pusher or facebook authentication 
Php :: array inserted in laravel 
Php :: simple-phpunit --version handling the phpunit-setup event returned with error code 127 on ubuntu 
Php :: https://stackoverflow.com/questions/58589741/angular-8-hide-divs-and-show-div-on-button-click 
Php :: laravel eloquent where if a variable has value 
Php :: echo alphabet links 
Php :: ussd php 
Php :: Laravel polimorfic faker 
Php :: PHP strncasecmp — Binary safe case-insensitive string comparison of the first n characters 
Php :: woo variable product get field 
Php :: namespace autoload php 
Php :: Laravel image validation just reloads page and does nothing 
Php :: echo $path not showing composer 
Php :: add multi product at the same time using repearter default view laravel 
Php :: union for rwos 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =