I want to create a bookmarklet that fills in 1st, 2nd, 5th and 6th text box with text so I can use the tool on the site more easily, because I use it frequently & it doesn't remember my input.
These are the ones with this text in front "Vertrek gemeente :" , "Straat :", "Aankomst gemeente :" and "Straat :".
Let me give some test values (in order)
"gent"
"PATIJNTJESTRAAT"
"OOSTAKKER"
"HERMAN TEIRLINCKSTRAAT"
about the site: it is a dutch public transport site were you can input your street and the destination street and then the web application will calculate which busses you should take and when you should take them.
about me:
I am a rookie at javascript. I know you can use getElemenbyId
but this site has a lot of scripts & such wich makes it hard to get the id. I do know there is a (firefox) addon+plugin which makes you inspect elements (to get the id). It's called firebug. I hope this is of any help. I'm not 100% sure bookmarklets is the way to fix my problem, if you got other suggestions feel free to reply (I heard cookies might be a solution? Or maybe a firefox addon?)
Thanks in advance if you can help to get the (javascript bookmarklet) code for this or a possible solution, Thank you even more if you provide me with working code. Thank a million if you are so kind to provide me with the code & explain how it truly works.
Try this :
javascript: { document.getElementById('form1:vertrekGemeenteInput').value = 'Zedelgem';document.getElementById('form1:vertrekStraatInput').value = 'Berkenhagestraat';document.getElementById('form1:vertrekNrInput').value = '44';document.getElementById('form1:aankomstGemeenteInput').value = 'Oostakker';document.getElementById('form1:aankomstStraatInput').value = 'Herman Teirlinkcstraat';document.getElementById('form1:aankomstNrInput').value = '1'; void(0) }
I tested this on Chrome, it works there.
As for getting the element, Open Chrome, then open the inspector ( on windows that is Control Shift J ), then hit the magnifying glass in the bottom left corner, then you hoover over the web page and you see elements turn blue, if you click on any element you will see in the Elements tab the relevant tag and you will see the id, that's how I found these id's. Je bent welkom ;)