javascript - error in filling form in using jqueryin a chrome extension? -
I am trying to fill the form using a jquery in a webpage inside the chrome extension. This is my code: (new.js)
chrome.tabs.onUpdated.addListener (function (tabId, changeInfo, tab) {y = tab.url; $ .get (y, function Web page {//console.log(data); $ (data) .find ('input') to parse (data) // function. Each (function () {// alert ("inside"); If ($ (this) .attr ('id') == "email") {warning ($ (this) .attr ('id')); $ ("# email"). Val ("xxx"); } //console.log ($ () text ());});});});
And there are many variations of the webpage and I want to fill in an input whose id ID is email. This is the html code for the webpage:
& lt; Form id = "login_off" action = "https://www.facebook.com/login.php?login_attempt=1" method = "post" onsubmit = "return window.Event & amp; appent.__inline submit & amp; ; Amp; amp; amp; amp; amp; incident; .inline submit inline (this, incident) "& gt; & Lt; Input type = "hidden" name = "lsd" value = "AVq0D9ew" autocomplete = "off" /> & Lt; Table cells = "0" & gt; & Lt; TR & gt; & Lt; Td class = "html7magic" & gt; & Lt; Label = "email" & gt; Email or Phone & lt; / Label & gt; & Lt; / TD & gt; & Lt; Td class = "html7magic" & gt; & Lt; = "Pass" for label & gt; Password & lt; / Label & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; TD & gt; & Lt; Input type = "text" class = "inputtext" name = "email" id = "email" value = "" tabindex = "1" /> & Lt; / TD & gt; & Lt; TD & gt; & Lt; Input type = "password" class = "inputtext" name = "pass" id = "pass" tabindex = "2" /> & Lt; / TD & gt; & Lt; TD & gt; & Lt; Label class = "uiButton uiButtonConfirm" id = "loginbutton" = "u_0_l" & gt; For & lt; Input value = "logged in" tab index = "4" type = "submit" id = "u_0_l" /> gt; & Lt; / Label & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; TR & gt; & Lt; Td class = "login_form_label_field" & gt; & Lt; Div & gt; & Lt; Div class = "uiInputLabel clearfix uiInputLabelLegacy" & gt; & Lt; Input id = "persist_box" type = "checkbox" name = "constant" value = "1" check = "1" class = "uiInputLabelInput uiInputLabelCheckbox" /> & Lt; Label = "persist_box" class = "uiInputLabelLabel" & gt; Keep me logged in & lt; / Label & gt; & Lt; / Div & gt; & Lt; Input type = "hidden" name = "default_percent" value = "1" /> & Lt; / Div & gt; & Lt; / Td> & Lt; Td class = "login_form_label_field" & gt; & Lt; A rel = "nofollow" href = "https://www.facebook.com/recover/initiate" & gt; Forgot your password? & Lt; / A & gt; & Lt; / TD & gt; & Lt; / TR & gt; & Lt; / Table & gt; & Lt; Input type = "hidden" autocomplete = "off" name = "timezone" value = "" id = "u_0_m" /> & Lt; Input type = "hidden" name = "lgnrnd" value = "225331_eElR" /> & Lt; Input type = "hidden" id = "lgnjs" name = "lgnjs" value = "n" /> & Lt; Input type = "hidden" autocomplete = "off" id = "locale" name = "locale" value = "en_US" /> & Lt; / Form & gt;
PSI does not have much experience with JPYER, so let me know if this question does not meet the SO criteria.
This is my obvious file: "password", "description": "password", "version": "0.1", "background": {"script": ["Jquery-1.11.1.js" "option", "tab", "active tab", "history", "http:", "new.js"], "constant": false}, "options_page": "Options.html", "Permissions" // [/ * / "," https: // * / "," http://ieeexplore.ieee.org/xpl/articleDetails.jsp?arnumber=6645369 "]," Content_script ": [{" matches ": [" Http: // * / "," https: // * / "]," js ": [" new.js "]}]," manifest_version ": 2} < / Code>
How about simplifying your code in:
Comments
Post a Comment