4 Replies Latest reply on Feb 14, 2015 6:52 AM by joel_pau

    How to get value of text (e.g. text() ) for self

    ta2909i

      Hi all,

       

      I have a number of text boxes that I use as buttons which configured at the start.

       

      When clicked they pass on their text value ( using "......text()" ) to a global function and then some magic happens.

       

      Currently I am using something like:

      var MyVar = sym.$("textbox").text();

       

      Which means I have to configure for each of my many text boxes e.g.;

           sym.$("textbox"),  sym.$("textbox1"),  sym.$("textbox2"),  sym.$("textbox3"),  .......

       

      Is there anyway of doing something like:

      var MyVar = sym.$SELF.text();

       

      So that I can simply copy paste the text boxes and their click triggers dont need to customized.

       

       

      Best,

       

      T

        • 1. Re: How to get value of text (e.g. text() ) for self
          joel_pau Level 5

          Hello,

           

          Well, your question is not very clear.

          1) You want to create a set. So, you can use a class (Edge UI: c button) or use a tag (Edge UI: tag button).

          2) Then, it seems you want to browse this set. And here i don't understand your goal.

           

          Can you post a sample file?

          • 2. Re: How to get value of text (e.g. text() ) for self
            ta2909i Level 1

            I don't really have a sample file yet . Because I am trying to figure a work around this issue.

             

            Basically I have a text box and I want to have a click event trigger that sends the value of its own text (i.e. ".text()").

            • var MyVar = sym.$("textbox1").text();

             

            However as I have 60+ of these text boxes it will take me a very long time to modify each click trigger so that they have the correct name. E.g.:

            • for "textbox1"        var MyVar = sym.$("textbox1").text();
            • for "textbox2"        var MyVar = sym.$("textbox2").text();
            • for "textbox3"        var MyVar = sym.$("textbox3").text();
            • ..........

             

            It would be much easier if I could point the ".text()" to "self", rather than opening each click event one by one and making sure that the right text box is referenced.

             

             

             

            BTW - if there is a way to handle click events from a global location then I can also address my problem.  if textbox1 pressed, then.... if textbox2 pressed, then.... if textbox3 pressed, then.... etc...

             

            Best,

             

            T

            • 3. Re: How to get value of text (e.g. text() ) for self
              joel_pau Level 5
              • How to manage several elements using classes or tags? A demo file to download: classes tags events.zip - Box
              • About events: you have an example (demo file). An event function and e.target can be used.
              • 4. Re: How to get value of text (e.g. text() ) for self
                joel_pau Level 5

                About your "self" word:

                It seems you want: new text = current text + a text.

                Then: sym.$("Text").text( sym.$("Text").text() + "added text" ) ;