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

  • You can use trim() in javascript to remove empty spaces. – Chandresh P. Apr 29 at 9:58
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, privacy policy and cookie policy

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