« first day (3750 days earlier)      last day (1420 days later) » 
07:00 - 20:0020:00 - 00:00

07:51
hey guys why cant i pass this array from the state to the variable tableData
class App extends Component {
    constructor(props) {
        super(props);
        this.state = {
            currentTime: 0,
            contacts : [{
                'id': 1,
                'name': 'Charlie',
                'surname': 'Manning',
                'phone': '3434343',
                'email': '[email protected]',
                'company': 'Number 16'
            },
            {
                'id': 1,
                'name': 'Charlie',
                'surname': 'Manning',
for some reason when console.log(tableData); it prints undefined / when console.log(this.state.contacts); i get the expected results not sure why its not setting correctly
08:49
@Kwsswart You don't have a tableData property
08:59
@BenFortune but i am setting it in the render() no? im setting it with this line
const {tableData} = this.state.contacts;
and passing it to the table with
 <Table tableData={tableData} removeContact={this.removeContact} />
or am i misunderstanding react?
09:13
I got it I understand now
You're misunderstanding object destructuring
const {tableData} = this.state.contacts; is the same as const tableData = this.state.contacts.tableData;
but that tableData prop doesn't exist in your contacts object
@BenFortune thank you for explaining mate I realize now the mistake I was making
You should be able to get away with just removing the brackets around tableData
const tableData = this.state.contacts;
I went with this solution:
render() {
        const {contacts} = this.state;
        return (
            <div className="container">
            <p>It is {this.state.currentTime}</p>
            <p>{this.get_time()}</p>
            {/* pass function and information to Table component */}
            <Table tableData={contacts} removeContact={this.removeContact} />
            </div>
        )
    }
09:29
that works too 😀
 
1 hour later…
10:58
@BenFortune Hi and besh wishes for this year
survived the storm as well? I heard that some people in the northern regions of UK got evac'd
it led to a conflicting thought: all people evac'd on a safe location, but there's a british variant of COVID-19 ...
@KarelG You too buddy. I live pretty rural so it was quite bad for me, didn't get flooded in but the roads to my house were flooded
11:16
handleSubmit(contact){
        console.log(this.state)
        this.setState({contacts : [...this.state.contacts, contact]});
    }
within this I cnnot understand why this.state is undefined
its a new method handling form submission but this.state is undefined whereas the component has its state defined as in the previous load
handleSubmit = (contact) => {
Or you need to do something like this.handleSubmit = handleSubmit.bind(this) in the constructor
171
Q: React: "this" is undefined inside a component function

Maximus Sclass PlayerControls extends React.Component { constructor(props) { super(props) this.state = { loopActive: false, shuffleActive: false, } } render() { var shuffleClassName = this.state.toggleActive ? "player-control-icon active" : "player-control-icon" re...

:/ Thanks for the link still new to JS this is the first project I am trying to build with React
12:01
Hey, I dont know too many internet people, but I know some of you guys, was wondering if I can get some opinions on my website that Ive been designing

https://mistersircode.com/
Ive setup multiple pages, project data, login systems
all sorts of goodies
Also I rewrit my login system to use actual forms this time around, which helped a ton, and now it supports autofill and stuff
12:15
> now it supports autofill
by the browser?
@MisterSirCode are you ok with desctructive feedback?
@KarelG Yes
@makadev id appreciate constructive feedback... destructive feedback isnt constructive towards solving an issue, which is... well... not useful... so no thanks
your site sucks
@BenFortune Design wise or code?
Ive been careful to keep the code clean
12:19
yes
which one???
.-.
alright
your sign up form throws errors that you aren't catching
well I thought the design was pretty good, and it works on all the devices Ive tested besides iphones
@BenFortune Oh... I didnt see that...
well, I tested out all 3 forms
the Register, login and Profile form, none of them had an error
except for the login form, it had an Imgur Request error because my profile picture link is blocked on this network
Can you specify what error youre seeing?
It could be a client side issue on your end
12:23
just enter a non-mail address and random pw
the message that the mail is not valid is not being displayed in the ui
please don't ask a regular end user to guess why nothing happens when clicking on the log in button
Obviously firebase auth is going to throw an error if you put in incorrect information...

Though I have been trying to work on UI so that errors will appear in the form
things like "invalid email" "email already in use" etc, I've just yet to have any time to do so, nor do I know how
@MisterSirCode They already give you those, just output them
and make it consistent: have all pages have a login/account UI
Uncaught TypeError: accountModal is null
    <anonymous> mistersircode.com/index.js:7
oh, the objects inside of the errors just look like an encoded mess, ive never bothered trying to retrieve the error message
probably missing something? :P
12:25
@KarelG yeah I never ported the login form to the other pages... guess that was lazy
Object { code: "auth/invalid-email", message: "The email address is badly formatted.", a: null, stack: "" }
> encoded mess
I did not even fill in something
only issue a submit if both inputs are filled in
oh.. they look different now
12:26
That design is pretty awful though, not gonna lie
OH I was logging the database errors before... thats why they were a mess
these are from firebase auth, not firestore
I see now
thanks
Overall the look is fine I think. But it might be a tad too much. To much opacity (too much distraction from content), too much shadow, backgrounds are fine but the first load hits like a truck. Also, Verdana as font? Stick to one of the current fresh open fonts like OpenSans, Robot, Railway, Noto..
oh.. and responsive pls
@BenFortune how could I improve it? I was trying to create something different from the boring every day white page with flat colored buttons and minimal fonts that I see all the time
> This is an empty project box. It has no content, feel free to ignore it.
12:28
HOW CAN I IGNORE THOSE BIG THONKS!
@MisterSirCode That's what people want to see, easy on the eyes and legible
btw, ensure that you have rights to use those images ...
Alright, so my site has quite a few issues...
I guess I didnt really think about it that much
pff.. every site has issues
12:30
^
even my CRM homepage has a little console error we're too lazy to fix
Well, maybe I just go too far of: "I want to make a site thats like no one elses!" and I wound up creating a design I think is good, but is pretty bad
@KarelG Well isnt that something all sites have? Youtube, google, facebook, and many other big organization websites have hundreds of little console errors
Every site does have issues
I also think that part of my design input... is game development.

I more often get influenced by UI design in games, then in websites
so I try to replicate it
Alright, well thanks for all the input
that game won't sell well, with those UI elements
@KarelG I wasnt saying that literally.. I just see a lot of guassian blur in UI, I wanted to use it in my website
12:55
@MisterSirCode firebase sucks
@MisterSirCode get rid of the background around the current page in the nav. Bold it or something.
13:25
@JBis Ok... why does firebase suck?
I mean, its free hosting, databases, authentication and its fast
vendor lockin mostly
Vendor what?
also that^
whats vendor lockin though?
13:35
In economics, vendor lock-in, also known as proprietary lock-in or customer lock-in, makes a customer dependent on a vendor for products and services, unable to use another vendor without substantial switching costs. Lock-in costs that create barriers to market entry may result in antitrust action against a monopoly. == Examples == === Microsoft === The European Commission, in its March 24, 2004 decision on Microsoft's business practices, quotes, in paragraph 463, Microsoft general manager for C++ development Aaron Contorer as stating in a February 21, 1997 internal Microsoft memo draf...
So whats wrong with them? Theyre providing a service that is free, compared to services that are complicated and expensive
if theyre saturating the market and causing the others to lose business
then isnt that the fault of the other businesses for not handling lower prices?
you have to know something really important: nothing ain't free
@MisterSirCode that article is about firestore but firebase auth and firestore are almost always used together so it's relevant. Also firestore auth specifically breaks multiple OWASP rules without any way to fix.
tbh i don't mind that people is using it for their little site.
@KarelG Then what by definition is free... Ive yet to pay a since cent to firebase
13:38
|| shrug
|| status
I am currently alive!
He cant read edits
@MisterSirCode they use your data
i guess he doesn't like you Karel
13:39
||> 'i love you'
@KarelG "i love you" Logged: `` Took: 1ms
@MisterSirCode dude you can setup a small vm on google cloud for free
Virtual machine?
also if you are getting a shitty product for free, it's still a shitty product
yes
@JBis Unfortunately we dont all have the luxury of a job or income, so us freelancers have to get what we get
13:43
but have you tried getting a much superior product for the same price (free)?
@JBis The problem is that things arent always free
google cloud doesnt appear to be free
"Free trial"
"for 90 days"
No. That's only one part. If you remain in free usage limits you can use it free indefinitely.
And you will, if you build it properly.
Are the limits any better than firebase?
if so, hows the workflow compared to firebase..
because setting up a VM and a server seems like it would take a lot more work than typing a word and having an instant website
13:47
that's the reason why there are a lot vulnerable websites
@MisterSirCode apples and oranges
@MisterSirCode if you don't want to setup the server side of things, you can go serverless. I'd probably suggest that for what you need.
just write your node (or whatever) login logic, copy and paste, and you're done
Anyone experienced with reading raw UDP port data in nodejs?
I tried that and gave up after one google search :D
Well can't really "give up" :P
@MisterSirCode I created a bunch of random accounts, I shouldn't be able to do that
13:57
@paul23 depends on your question, AFAIK it's not much different than using udp sockets in any other language
@paul23 "Giving up should always be an option" - John Joe, Failed inventor of the computer
@JBis Shameless! Besides the article kind of gives me creeps -- you're mixing application layers and security topics. Which are quite tangential to each other.
IE things like graphql and react quite violently shake the idea of layers into something different - but have no effect on security.
Well, in this case it does and did effect security.
The application/design layers are relevant because security is built around those layers.
@makadev I'm mainly looking into some example of how to listen to a port and just "log" all incoming traffic. To transform some C/python server to node.
Presentation Layer (on the client)

button.addEventListener('click', () =>
    firestore.doc(`users/${x}`).update({
     points: firebase.firestore.FieldValue.increment(5)
    })
);

--->

Data Layer (handled by Firestore)

Increment points of user with id x by 5
You give that as example of "unsafe" - but that doesn't say anything. Using graphql for example one would just check the incoming request and validate that the increment is within the limit set by security.
Which is equally secure (unless you wish to hide that clicking a button will in fact increase the value by 5, but I do guess you show the end result which is the value increased by 5 right?)
@paul23 nodejs.org/api/… should be mostly it
14:04
@paul23 He has covered that further in the article as someone commented that you can set rules at firebase
it is possible to add that additional checks as rules, but that list becomes a PITA when it becomes too large
I'm confused by "datagram" in udp, is there anything that makes "datagram" special.
it contains sufficient information to reach its destination
Doesn't any udp package have that?
14:06
^ regardless of order
UDP is all datagram
user datagram protocol
oh, lol til (or well I ought to have learned that in highschool).. didn't know what udp actually stood for.
@paul23 hence "datagram" in its protocol name :P
isn't there a new thing that google developed
Still means library "udp/datagram" seems tautology; it implies `udp/somethingelse" exists :P.
its tcp but much more efficient?
QUIC (pronounced "quick") is a general-purpose transport layer network protocol initially designed by Jim Roskind at Google, implemented, and deployed in 2012, announced publicly in 2013 as experimentation broadened, and described to the IETF. While still an Internet Draft, QUIC is used by more than half of all connections from the Chrome web browser to Google's servers. Microsoft Edge, Firefox, and Safari support it, even if not enabled by default. Although its name was initially proposed as the acronym for "Quick UDP Internet Connections", IETF's use of the word QUIC is not an acronym; it is...
14:09
@JBis window scaling?
oh...
@MisterSirCode also, why do you need login/signup functionality for a porfolio/resume website?
Lol we still don't use http/2 (mainly due to difficulty that a lot of browsers don't support it, yet it has to be build into our load balancer) - and I notice this requires http/3 XD.
Anyone else think tesla is completely overvalued?
I really don't think what they are doing is so amazing it's worth 1600x their profits.
I don't think that's uncommon.. Though something is as valuable as what the fool wishes to pay for it.
14:25
1600 is crazy
considering market average is like 20 and tech average is a bit higher
I just stay away from that. Musk is capable to manipulate the stocks. So I do not trust it.
Big difference between tesla and conventional car companies is that tesla still has the aura of "startup". So they can "make mistakes and move fast" without backlash. Mistakes are easily forgiven.
Conventional companies move hence much more slowly since they are dead set on not having a single error in their new (self driving) cars before even announcing it to public.
@paul23 it's backwards compatible, you're only hurting yourself by not enabling it
he even got an investigation from SEC before
what LB are you using?
14:27
@BenFortune Hmm so I can just set nginx to supply "http/2" instead of http/1.1 and it all works?
self driving is easy
Just an nginx server
and more importantly, isn't proprietary
load balancing = balancing based on paths, not on actual load for us. So it's static balancing
@JBis sorry, but no.
I've studied aerospace engineering. With a focus on control systems: and I can tell you it's far from "easy" to write a stable control system that keeps working (or even defining a clear envelope under which it works).
by easy, i mean everyone is doing it and tesla doesn't seem miles ahead of competition
considering much of tesla's hype is their self driving capabilities, i don't think it'll ever reach what investors are saying it's value will be
14:33
that reminds me that Uber is investing in that tech as well
lol uber isn't even profitable
Well by virtue of "being forgiven some child/grow errors" tesla will be one of the first to bring it on the market
so investors are banking up on the hype that follows this "first on the market" approach, and they value is in early adopter abusing.
in tech, thats a stupid plan
Google did so as well
For it's first 10-15 years google was losing big piles of money.
Apple basically steals other peoples great ideas from shitty implementaitons and develops a much better implementation of the same idea. They are always second....or more often like 10th.
Apple didn't invent touch. Or touch on a phone.
14:36
They're not alone :P
Thier latest thing, M1, they didn't invent the idea, they just implemented it really well.
that's mega corps now.
@JBis Einstein build his theory of special relativity basically on the ideas of one his (female) doctorates.
taking over other idea's (with budget and resource to improve it)
I'm not looking down on it. It's a great way and very successful way of doing things. My point is, "first" isn't as important as "best".
14:38
@paul23 just curious why you've added (female) 🤔
Because the time period: early 1900s so female voice wouldn't be looked at so seriously as a male doctorate.
15:16
@JBis Because I need an entry point to create / manage accounts, because those accounts are synced across my Game, my Discord Bot and my Website
I bought a new domain yesterday for my game where Im probably going to move it
but for now I just added it to my main site
15:38
o/
\o
So I am using jQuery to pull information from a SharePoint list, based on certain criterion. I.E. based on the Date. I want to take all info relevant to that date and post it to another page in an orderly fashion with headings/subheadings relevant to what was posted to the list from the HTML form so it may be printed.
16:47
Since I use a spa, the website is an actual application. This made me worry: shouldn't I clear browser state (history, etc) on logout? Since the urls themselves contain information that might be private.
@paul23 urls shouldn't contian private info
Like that I looked at "penile extensions for cheap" page can be quite private..
And often the item you look at in a store is stored inside the url
then they should use private browsing
otherwise just base64 encode the search query
Well but shouldn't the website itself be responsible to hide private information? Even private browsing is quite bad as it often leaks with stored information on hdd and it's hard to notice that unless the website shows clearly what it stores.
Or take things like cookie settings: shouldn't those be on a per user base instead of for "everyone"?
17:14
@paul23 And how / why would users have access to other user's URL information...
You should be using SSL and keeping all of that data immediately private
24/7
@paul23 no
You could be *super* secure, and use SSL (https should be used everywhere, no matter what), and clear the history via javascript, you could also disable the "coming from ___" headers (I forgot what theyre called) which tell the next site where youre coming from.

Furthermore, you could delete cookies... unless your site depends on them
Other than that, just using SSL should be enough
it's websites responsibility to not allow external attackers from accessing private data (e.g. another user)
@MisterSirCode this has nothing to do with anything
17:39
Hii
@AshikaKamath Welcome to the JavaScript chat! Please review the room rules. If you have a question, just post it, and if anyone's free and interested they'll help. If you want to report an abusive user or a problem in this room, visit our meta.
Any body can help me
> If you have a question, just post it, and if anyone's free and interested they'll help
1
Q: Creat copy button from Javascript

Ashika KamathHey am new web developer and I have been working on a project. I was working on a quote website. Firstly you visit my CodePen and visit my project. Please visit my CodePen website then answer or else you cannot understand the question or else I have written my project in the bottom. https://codep...

 button.addEventListener('click', function() {
     let statusElement = this.closest('.latestatus');
you are mixing jquery and vanilla
vanilla tastes better, stick with that
17:43
^
Jquery is nearly irrelevant nowadays, since javascript supports most of the general use features by default
1 message moved to Trash can
1 message moved to Trash can
1 message moved to Trash can
3 messages moved to Trash can
Am using mobile how can I click ctrl+k
you can add 4 spaces in front of each line yourself ;P
@JBis PS... How do I setup Hosting with google cloud like you suggested earlier?

Ive gone and setup a new project, Ive even gone and authentication my Website Domain so that I can connect to it with google cloud
Just dont know where to go from there
17:51
@AshikaKamath Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
1 message moved to Trash can
Please see my code in trash
Did anyone got my answer
PS... youre not copying the text
youre trying to copy the innerHTML
infact, Im not sure if you can even use innerHTML to return the html
either way, its either innerText or value when trying to get the text of an element
@MisterSirCode do you just want to host the backend or also the frontend?
do you want to go serverless or use vm?
I have changed it to inner text although it's not working. Although why my custom copy alert is not showing when a button is clicked.
Is anyone here
18:14
I'm trying to use JQuery in ASP.NET Core MVC but it's not working. The following is the JQuery code:
Damn, thanks. I'll try again
@BlackPanther Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
For posting large code blocks, use a paste site like like gist.github.com, hastebin.com, pastie.org or a demo site like jsbin.com
$(#demo).html("Hello, World!");
no
you need quotes
$('#demo').html("Hello, World!");
however, if you don't have a specific need i suggest you don't use jquery
@JBis Why not?
99% of the time theres no reason to
This is why I need JQuery:
18:16
document.querySelector('#demo').innerHTML = 'Hello, World!';
That was a hello world example.
My real use case for JQuery is shown above.
i don't know what that means
Sorry, let me explain
what does that photo mean?
I have an app that will connect to other websites like twitter, etc. using OAuth2
Instead of my app asking for username and password.
When a user clicks a button to connect to twitter, facebook or instagram, I want the status of that button to change from connect to forget
18:22
button.innerHTML = 'Forget';
@JBis What's button here?
A class or something else?
no its a variable
document.querySelector('.button').innerHTML = 'Forget';
@JBis Thanks, that works :)
@JBis Okay, what would that have done?
@JBis does does JQuery slow down a web app?
Is there any way to speed up queryselector? Server sends a list of selectors that need an HTML attribute, so I simply do queryselectorall and pass the server provided selectors in a comma separated string. All matches get the attribute added on them. But as the list of selectors is going up, queryselector is becoming slower. The query selector may also be executed multiple times inside a mutation observer. Is there anything I can do to make the selector be quicker?
const buttton = document.querySelector('.button');
button.innerHTML = 'Forget';
@BlackPanther yes but not enough to matter
18:33
Dont forget: Dont use innerHTML with text
use innerText
yes ^, but i was showing equivilent of jquery code
@DemCodeLines odd. why are you doing this?
Requirement to tag specific elements in the application centrally...
wdym?
if you absolutely need to do that, i'd make an async selector function. But i still doubt its necessary.
19:00
I used JQuery to change the label of a button from Connect to Forget, when clicked. However the button does not stay as "Forget".
Here is my code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
    $(".button1").click(
        function ()
        {
            $(".button1").html("Forget");
        }
    );

    $(".button2").click(
        function ()
        {
            $(".button2").html("Forget");
        }
    );

    $(".button3").click(
        function ()
        {
            $(".button3").html("Forget");
        }
    );
    //$(".button").html("Hello, World!");
what happened to not using jquery?
How can get the label for a button to stay as "forgotten"
I need to learn JavaScript first. JQuery has good documentation, and the syntax is easy
Jquery is literally javascript
but with daisy chained lazy methods
@BlackPanther https://repl.it/@skylerspark/test#index.html
There ya go
I even added a QuerySelector bind to $ to make it easier for you
const $ = document.querySelector.bind(document);

$(".buttonOne").addEventListener("click", (e) => {
    e.target.innerText = "Forget";
});

$(".buttonTwo").addEventListener("click", (e) => {
    e.target.innerText = "Forget";
});

$(".buttonThree").addEventListener("click", (e) => {
    e.target.innerText = "Forget";
});
Simple
Check if that works
if it doesnt stay labeled "forget" then you have code elsewhere setting it's innerText / innerHTML
user14692552
I am trying to read from a SharePoint list that has values (WeekOf, Team, Offensive Report, Defensive Report, and Special Teams Report). I need to get it to post to a html page in this format
user14692552
19:08
NFL Weekly Team Report
<Week Starting Date (i.e. [Week of 1/25/2021])>

Team - Raiders

Offensive Report
<summary of offensive report>

Defensive Report
<summary of defensive report>

Special Teams Report
<summary of special teams report>

Team - Cowboys

Offensive Report
<summary of offensive report>

Defensive Report
<summary of defensive report>

Special Teams Report
<summary of special teams report>
user14692552
Those are examples I have as Team, but that is staying dynamic always changing. how can I define the JS/HTML to post it like I want it to post. Use null <td> and assign IDs to them?
user14692552
then have those IDs post to the corresponding <td> cell through an AJAX call?
@codingdreaming Honestly if you want something dynamic, itd be better to setup a String Literal that outputs to document.body.innerHTML with tables and table cells procedurally placed into the string
I wouldnt call to any specific cell and link it to a request unless you want static data
@MisterSirCode Thanks, but what does querySelector.bind(...) do?
All it does is bind the function to a custom variable
so normally youd call document.querySelector(".cssSelector") to select an element
19:15
@MisterSirCode don't confuse him with the $
but by binding it to $ you can just call $(".cssSelector") to retrieve an element
@JBis He said he liked JQuery's simplicity, so I gave it to him
@MisterSirCode How do you make the button's label return to it's original state (the label Connect) when pressed again?
@BlackPanther Make a flipflop using a boolean. One sec, Ill write a quick one
@MisterSirCode in the line const $ = document.querySelector.bind(document); there is no identifier?
@MisterSirCode dont write it for him
teach
19:16
Just a dollar sign
user14692552
a dollar sign
user14692552
hahaha
let buttonOne = false;

$(".buttonOne").addEventListener("click", (e) => {
    if (buttonOne) {
        e.target.innerText = "Connect";
    } else {
        e.target.innerText = "Forget";
    }
    buttonOne = !buttonOne;
});
@BlackPanther dollar sign can be used in varible names its just a name
Is your code plain javascript?
19:17
  e.target.innerText = buttonOne ? "Connect" : "Forget";
@MisterSirCode What custom variable is it binding the function to?
Oh heck Ill just remove the custom stuff
@BlackPanther There ya go.

Vanilla javascript button clicks + a tflipFlop boolean button https://repl.it/@skylerspark/test#script.js
@JBis I see
That boolean is just inverted every click, and it detects if the boolean is true or false to display a string
I understand that part, thanks
I'm not sure if your code is plain javascript or jquery. Can you specify which?
19:23
Plain Javascript
Always... I havent touched JQuery in years
user14692552
I am just confused. Once I have the JSON of things I have grabbed from my SP List, thats the easy part for me unfortunately.

I am confused about how to populate the HTML document like I demonstrated up a few messages. I understand the document.body.innerHTML, but would I use that to populate everything?
user14692552
I feel like mushbrain rn
@MisterSirCode What variable? $ is not a variable, and you mean it binds the return value of the function, not the function itself?
@MisterSirCode pretty sure you asked about jquery in 2020
@JBis did I?
You dont have to use that, however, if you want, you can.

All that does is bind the function to the variable.

So document.querySelector(".elementClass") basically BECOMES $(".elementClass")

.bind() documentation: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_objects/Function/bind
it essentially copies the function, and rewrites it to that variable
I got to go
19:30
@MisterSirCode Oh wait, you mean that querySelector.bind(...) binds the querySelector function to a variable? Is the purpose of binding a function to an identifier to reduce verbosity in code?
Damn I like that a lot :)
I understand the rest of your code now. Thanks :)
user14692552
@MisterSirCode so maybe something along the lines of this? developer.mozilla.org/en-US/docs/Web/API/DOMImplementation/…
user14692552
I keep looking at W3 for help and I forgot how awful that website is
instead of e.target.innerText, can e.innerHtml be used instead?
user14692552
<body>
  <p>Click <a href="javascript:makeDocument()">here</a> generate the Weekly Report</p>
  <iframe id="theFrame" src="about:blank" />
</body>
user14692552
function makeDocument() {
  let frame = document.getElementById("theFrame");

  let doc = document.implementation.createHTMLDocument("New Document");
  let p = doc.createElement("p");
  p.textContent = "This is a new paragraph.";

  try {
    doc.body.appendChild(p);
  } catch(e) {
    console.log(e);
  }

  // Copy the new HTML document into the frame

  let destDocument = frame.contentDocument;
  let srcNode = doc.documentElement;
  let newNode = destDocument.importNode(srcNode, true);

  destDocument.replaceChild(newNode, destDocument.documentElement);
19:32
@codingdreaming Please don't post unformatted code - hit Ctrl+K before sending, use up-arrow to edit messages, and see the faq. You have 25 seconds to edit and format your message properly before it will be removed. Please separate code blocks from your actual question. Put your question in 1 message and then your code in a 2nd and format it.
user14692552
piss off James I was trying to fix it
user14692552
getting roasted by a bot
user14692552
Actually... @MisterSirCode so I can achieve this in essence without using any HTML at all? I could just use JS HTML DOM to achieve this? Or is that incorrect
user14692552
By no HTML I mean no hard coded HTML
@BlackPanther no
@MisterSirCode no
> The bind() method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.
19:55
@MisterSirCode The link you provided is not toggling the button back to its original state
@JBis this is my code to toggle three buttons to "Forget" when clicked, and back to "Connect" when clicked again. It doesn't work though.
<script>
    const $ = document.querySelector.bind(document);

        $(".buttonOne").addEventListener("click", (e) => {
            let clicked = false;
            if (clicked)
            {
                e.target.innerText = "Forget";
            } else {
                e.target.innerText = "Connect";

            }
        });

        $(".buttonTwo").addEventListener("click", (e) =>
        {
            let clicked = false;
            if (clicked)
            {
                e.target.innerText = "Forget";
07:00 - 20:0020:00 - 00:00

« first day (3750 days earlier)      last day (1420 days later) »