javascript and greasemonkey question
-
21-09-2019 - |
Question
i wanna get a price inside a page and then multiple it by 0.93 then write the result after first price. but i couldn't be able to grab the price from page.
for example i want to grap "900 TL" string from "900 TL"
you can see all codes of page by visiting http://www.sahibinden.com/cok_temiz_asus_f3jp_t7200_2ghz_2gb_ram_256_mb_harici_ekran_ka-49WQQaXQQ17829315WQQpXQQdisplayitem
thx a lot.
edit: the "f16 bold" string counts only 1 on that page. so maybe we can get "900 TL" with this..
Solution
Try this:
document.getElementsByClassName('f16 bold')[0].textContent = document.getElementsByClassName('f16 bold')[0].textContent + ' (' + parseInt(document.getElementsByClassName('f16 bold')[0].textContent)*0.93 + ')';
Note: getElementsByClassName has poor browser support (in Firefox, 3.0+ I believe).
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow