I want to load these field values via extension popup when the anchor link is clicked. How can I do that?
Asked
Active
Viewed 91 times
0
-
do you have filldata defined anywhere? – Jay Lane Nov 10 '17 at 03:28
-
What do you mean? – 7O07Y7 Nov 10 '17 at 03:31
-
Possible duplicate of [onClick within Chrome Extension not working](https://stackoverflow.com/questions/13591983/onclick-within-chrome-extension-not-working) – wOxxOm Nov 10 '17 at 03:32
-
@wOxxOm This question is not related to `onclick` not working in Chrome. The function is just not written/called correctly. – Chava Geldzahler Nov 10 '17 at 03:35
-
You can't know it's not related. It's a typical mistake in extension development. Anyway, the question doesn't provide complete info so no need to answer it prematurely. – wOxxOm Nov 10 '17 at 03:38
-
@wOxxOm To me it seems OP is trying to fill two input fields with data `onclick` of a button. However, the function is not being declared/called correctly, and is obviously not working. (See the next answer, which does the same thing using jQuery) – Chava Geldzahler Nov 10 '17 at 03:43
-
No need to argue over an incomplete question. The correct action is to urge the OP to provide the missing info - whether the code runs in the extension popup or whatever. – wOxxOm Nov 10 '17 at 03:47
-
Sorry for the confusion yes i am trying to run it in an extension popup which will inject onto a page and fill the data when clicked – 7O07Y7 Nov 10 '17 at 03:50
1 Answers
1
Using pure jQuery since you're already using some of it
$(document).ready(function() {
$("#fill").click(function(){
$("#user").val("name@email.com")
$("#pw").val("pass123")
})
})

JoshMoxey
- 36
- 4
-
That works but i need it to be able to load via an anchor link/button as I'm putting it into a chrome extension (popup.html) – 7O07Y7 Nov 10 '17 at 03:45
-
This answer assumes you should add `id="fill"` to your html of the link. – wOxxOm Nov 10 '17 at 03:55