This question already has answers here:
Access 'data-' attribute without jQuery
(5 answers)
jQuery: get data attribute
(5 answers)
Closed 5 years ago.
There's this pack simulator on a website I frequent. You are randomly given 10 basketball players in the game with various values on how much they are worth. When you load the page, the cards are face down so you have to click on each one to "reveal" the card and add to your total. The idea is to maximize the value of each pack.
I figured out that the flipping is all show and the total pack score is actually there as soon as you load the page. So I'm trying to write a greasemonkey script to refresh the page until the value is above a certain threshold. I can get to the span with this code:
document.getElementsByClassName("pack-score")[0];
which gets me a span that looks like this:
<span class="pack-score" data-score="12352">
So how would I access the data-score value inside that span, so I can then use it as a value for the code logic?
document.getElementsByClassName("pack-score")[0].getAttribute('data-score')
or in jquery
$(".pack-score").find('span').data('score')
Related
This question already has answers here:
repeat css background image a set number of times
(7 answers)
Closed 2 years ago.
I know how to make a tiled background in HTML using the repeat element, but I was wondering if I could get the image to repeat a certain number of times? Is there any way I can control that...?
Sadly, there is not CSS option for this, The best hack you could get is to make more divs with this background and have them placed where you need them.
I have also heard that there is a way to do it with jquery, but that is beyond my knowledge, so you could look there.
This question already has answers here:
Move mouse cursor using javascript in Chrome or Firefox using any method (Plugin, GreaseMonkey?)
(3 answers)
Closed 8 years ago.
So I am making a hover game for my webpage. I just want my mouse to automatically point at a point say a button or a box i create with css when that page loads.
is there any way to do this?
No. There's no way for a web page to control the position of the mouse cursor.
This question already has an answer here:
How do I handle object existence with QTP?
(1 answer)
Closed 9 years ago.
i have a requirement to verify that for a selected value in a drop down list in a webpage, one text box in the same page gets invisible or not. But when i checked the run time properties (disabled and invisible) of the textbox, in both cases i.e. when visible in the page and when not visible in the page.. both the properties are coming out to be same in both cases. What else i can do to verify the same. I am using qtp 11.0
You could try using readonly property of text field.
Thanks.
This question already has answers here:
Styling <select> tag for iPhone
(4 answers)
Closed 3 years ago.
I am writing a webpage and sometimes the "picker" wheel on select elements scales the font down so that it can all be read and sometimes it just puts the "..." in the text to shorten it but leaves the size of the font untouched.
Is there a way to specify which method is used? I would like the font size to be scaled appropriately.
Thanks!
You use the picker data source method that returns a view, not a string. In the view you put a label, and set the font options as you want there:
– pickerView:viewForRow:forComponent:reusingView:
This question already has answers here:
How to use square cursor in a HTML input field?
(6 answers)
Closed 6 years ago.
I want to have a custom text caret in my text field for my web page. I would like to have an old school block type blinking caret. Is this possible?
The simple answer is you can't (change the user's blinking caret) via javascript, html, or css as that is created and managed by the chrome (the browser beyond the DOM)
Wanna fake it?
http://www.dynamicdrive.com/forums/showthread.php?t=17450
The code examples shown are pretty old, but the idea remains the same-- Make a blinking box and have it tail the input...
With thats all said, I highly suggest against using it in anything but the smallest, niche, 'for fun' way as having a javascript function fire and be altering the DOM on every keyDown is bordering on user abuse imho.