Wednesday, 15 June 2011

jquery - javascript iterate through dom looking for specific aria-label -


I have spent hours on this one.

My company has been forced to use a non-user-friendly third party website. We only use IE11. My work is to use javascript and jquery to customize the screen and Makes things a little easier for our users. I have the & lt; Script & gt; I use a bookmarklet to insert tags and referenced locally saved .js files.

This website uses hundreds of input text fields, but only a handful of them Therefore, I want to highlight the input text field on the screen. In some areas ID is only a few names. For the most part, this works:

$ (document.getElementById ('s_3_1_18_0'). ToggleClass ("highlightField"); $ (document.getElementsByName ('S_3_1_19_0') [0]). ToggleClass ("highlightField");

Highlightfield Bus CSS Color: Yellow! Important

The problem is that this third party changes the application ID and name in a strange way, one day, the name will be 's_3_1_19_0', next it will be'_3_2_48_0. 'Highlighting using this method is not static. / P>

However, in these areas one area I have been thinking that to use javascript or jquery to repeat it through each text box, looking for a specific AIRA label. For example, the "valid" is a strange name for the field. Which changes all the time, but this area label is always "valid".

Can anyone help me with this?

AIR-label by searching for you" Valid Mitigation can get "input

  $ (document) .find ( 'input') for. Attr ('aria-label', 'valid to');  

I recommend being slightly more specific than $ (document) , though. He searches for the whole doctor.


No comments:

Post a Comment