0
 <td data-th="<?php /* @escapeNotVerified */echo __("Quote Id")?>" class="col quoteid">
                                        <span class="label"><?php /* @escapeNotVerified */echo $quote->getId(); ?></span>
                                    </td>

enter image description here

if I click on accept button, I want to get first row (value)

here is I tried but I'm getting more empty spaces and ("\n") and (,) like this

<script type="text/javascript">
    require([ 'jquery', 'jquery/ui'], function($){
        $(document).on("click","#acceptnow", function(e) {
 var currentRow=$(this).closest("tr");
            var col1=currentRow.find(".quoteid").text();
            var col2=currentRow.find("td:eq(3)").text();
            var col3=currentRow.find("td:eq(5)").text();

}

how i can get the values in proper ways (the values) in jquery magento 2

1
  • You can use trim() in javascript to remove empty spaces. Apr 29, 2019 at 9:58

1 Answer 1

1
<script type="text/javascript">
    require([ 'jquery', 'jquery/ui'], function($){
        $(document).on("click","#acceptnow", function(e) {
 var currentRow=$(this).closest("tr");
            var col1=currentRow.find(".quoteid").text().toString().trim();
            var col2=currentRow.find("td:eq(3)").text().toString().trim();
            var col3=currentRow.find("td:eq(5)").text().toString().trim();

}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.