0

I have an html table in which i'am showing a result of my json object.

<article id="article2" style="top: 50px !important;">
            <div class="content" id="content_resultat">
                <table width="100%" class="display" id="resultats_client"></table>
            </div>
        </article>

I added a click button,double click button functionalities that are working fine in my dev environment

 $(document).on("click", "#resultats_client tbody tr", function () {
        debugger;
            if ($(this).hasClass("selected")) {
                $(this).removeClass("selected");
            } else {
                resultats_client.$("tr.selected").removeClass("selected");
                $(this).addClass("selected");
            }
        });
        // double click
        $(document).on("dblclick", "#resultats_client tbody tr", function () {
         debugger;
                var row = resultats_client.row(this).data();
                if (row == undefined) return;
                var parameters = {};
                parameters["id"] = row.id;
                OREKA.SDK.formUtils1.openEntityForm("account", null, parameters, null);
            });

But in my Test environment i am getting this error enter image description here

nando99
  • 13
  • 4
  • 3
    `resultats_client.$()` totally looks like a typo. You never define such variable, and it's unclear why it should have jQuery as child method. – Álvaro González Apr 18 '22 at 11:38
  • `resultats_client.$("tr.selected")` -> `$("#resultats_client tr.selected")` – freedomn-m Apr 18 '22 at 11:40
  • @ÁlvaroGonzález I'm new to html/jquery so I just found this method ,use it and it worked for me in my dev environment.how i can change this? – nando99 Apr 18 '22 at 11:41
  • "*You never define such variable*" but unfortunately it actually exists. It's unfortunate since it's some of IE leaking into other browsers: [Do DOM tree elements with IDs become global properties?](https://stackoverflow.com/q/3434278) With that said, `resultats_client` is still just the DOM element. What freedomn-m says is most likely what was meant here. – VLAZ Apr 18 '22 at 11:44
  • @freedomn-m it's worked for my click, but still my double click isn't working – nando99 Apr 18 '22 at 11:56
  • @VLAZ $("#resultats_client tr.selected") has worked, but still my double click isn't working. – nando99 Apr 18 '22 at 11:57
  • You cannot call a method of an object using the $ sign. – dkum Apr 18 '22 at 12:04
  • 1
    @dkum you *can*. It's just such a method does not exist on DOM nodes. – VLAZ Apr 18 '22 at 12:13

0 Answers0