Take a look at this fiddle…the (business) user of a web app is requested to fill services names in the inputs you see…
I am in the process of performing various tests in the form and as a result of this I must fill the inputs again and again…so I am trying to find out if there is any way I can automate this.
You’ve got more fields in there than those you showed me in the fiddle. So it’s written things into the first 6 fields with the “text” class. Specifically, there are 16 elements with “text” as a class.
It is OK now but some answers are needed…
How the h…l were you able to figure out that there are 16 elements with class text.
Did you figure it out from the console screenshot?
I just pasted your fiddle HTML into my editor and counted them. That said, some were commented out and therefore not relevant, which reduced the number to 12, but 6 of those were in a type="text" attribute, leaving 6 as class="text".
I’m not entirely sure what the ‘m’ comes from, possibly a jquery definition for it’s class… but essentially it’s the generic function (fn) calling init (because it’s initializing an object, in this case, the selector).
One last thing…(my mistake I did not mention it earlier).The code you gave is about filling service and price inputs…additional code is needed for selecting also an for the radio buttons-you can see these in the fiddle too…click edit and the radio buttons are located on the right of the inputs.
So to do that, you’d have to click the edit button, wait until it renders the objects, and then check the radio buttons.
Here’s a breakdown of that sentence:
jQuery exposes a .click() method.
Waiting would be just a momentary pause (setTimeout)
The radio button array can be referenced as $('.show_price') [Alternative method of pause: Check for a member of that selector to satisfy the Visible selector]
Radio buttons react to their .val() being set.