If I'm adding a form to my page dynamically (whether through AJAX or other JS), how can I add event listeners to those elements on pageload before they exist?  I know with jquery it's fairly easy to bind to a parent element, something like this:  $(document).on('blur', 'input', function() {...})   but I'm unclear on how to do this with vanilla JS as addEventListener must be applied directly to the element itself and can't specify the parent element for which the event should propagate? (I think, right..?)
I have a bit of code where I am looping through all the select boxes on a page and binding a .hover event to them to do a bit of twiddling with their width on mouse on/off.  This happens on page ready and works just fine.  The problem I have is that any select boxes I add via Ajax or DOM after the initial loop won't have the event bound.  I have found this plugin (), but before I add another 5k to my pages with a plugin, I want to see if anyone knows a way to do this, either with jQuery directly or by another option.
Why is wine made 'from' grapes, but tables are made 'of' wood? (1) Wine is an alcoholic beverage made from fermented grapes or other fruits. (Wikipedia) (2) Tables were made of marble or wood and metal (typically bronze or silver alloys), sometimes with richly ornate legs. (Wikipedia)  Why is 'from' used in (1), whereas 'of' is used  in (2)? Is it a stylistic choice whether to use 'of' or 'from'? Or, in case of chemical changing, differently from changing in shape only, 'from' is preferable? Algorithm over 2 pages I am writing a few rather large pseudocode functions using algorithm and algorithmic, i.e. my code looks something like:  \begin{algorithm}                      \caption{Coolest Algorithm ever}           \label{findme}                           \begin{algorithmic} [1]                   % enter the algorithmic environment \REQUIRE    Here are a few variables \\             variable 2 \\             variable 3  \ENSURE     this is the output \\             output 2  \STATE $some cool code here$ \STATE $some cool code here$ \STATE $some cool code here$ \STATE $some cool code here$ \end{algorithmic} \end{algorithm}   Unfortunately this code does not fit on one page and I am definitely not able to split it into some subfunctions or so (I already did that as far as possible).  So now I need to split up the algorithm into two pages, but I have no idea how.  The easiest way I can imagine is just to start a new algorithm on the new page, but this time letting the line counter start at line 35 or so instead of 1. But how can I do that?  Please not that there is already a similar question here on this site, but it deals with the package algorithmicx. Lightning Community Does Not Support pubsub for Lightning Web Components? Has anyone successfully used the pubsub module from lwc-recipes to enable inter-component communication in a Lightning Community?  The registerListener function in the pubsub module throws an error because the pageRef property is undefined.  Or is pubsub designed for Lightning Experience only? How do you update an Excel file (Data Refresh and update formulas) WITHOUT opening the file? I have an Excel file that want to update and save automatically with out having to open it or manually interact with.  Manually, I open the file up and hit data refresh which goes and does a SQL query and then hit F9 for the formulas to update and then I just close/save.    (I then would mail the file out to people using a perl script or use SAS JMP to run some numbers/charts and also mail them out.  Basically I need to script some things which require the XLS file to be updated.) How to modify function argument? What's the value of $\sum\limits_{k=1}^{\infty}\frac{k^2}{k!}$? For some series, it is easy to say whether it is convergent or not by the "convergence test", e.g., ratio test. However, it is nontrivial to calculate the value of the sum when the series converges. The question is motivated from the simple exercise to determining whether the series $\sum\limits_{k=1}^{\infty}\frac{k^2}{k!}$ is convergent. One may immediately get that it is convergent by the ratio test. So here is my question:     What's the value of $$\sum_{k=1}^{\infty}\frac{k^2}{k!}?$$ How to get the current URL within a Django template? When the loop is the figure shown below will be rotated in clockwise direction the the slip ring connected to the red segment of the loop will give us the positive voltage and the slip ring connected to the black segment of the loop will give us negative voltage according to the Flemings right hand rule.  What if the loop is rotated in counter clockwise direction ? Will the slip rings provide us the same polarities which they were giving when the loop was moving clockwise ?  Plus  The voltage from the loop is given by the equation.  V(t) = Vmaximum * sin (theta)  Where theta is the positive angle the red segment makes in the clockwise direction or in counter clockwise direction from this position ? I'm looking for a bijection from the closed interval [0,1] to the real line. I have already thought of $\tan(x-\frac{\pi}{2})$ and $-\cot\pi x$, but these functions aren't defined on 0 and 1.   Does anyone know how to find such a function and/or if it even exists?   Thanks in advance! Why doesn't PHP DOM include slash on self closing tags? Listings: text highlighting based on prefix How can I apply different styles to keywords depending on their prefix?  Here is some sample code:  (-2,0,0) (2,1,1) op-registerbox !box1 ;box1 /Blue op-setproperties   I'd like to typeset   words starting with ! and ; in color red, words starting with / in color green, words starting with cp- in bold.   So far, this is what I've got:  \lstdefinelanguage{XX} { basicstyle=\small\sffamily\fontseries{c}, emphstyle=\underbar, keywordsprefix=[2]{/}, alsoletter={/}, keywordstyle=\textbf, keywordstyle=[2]\color{green}, morekeywords={op,registerbox, ...}, morestring=[b][\color{green}]", columns=flexible, escapechar=\%, numbersep=6pt, numberstyle=\scriptsize }   I'm aware that only one keywordsprefix can be defined at the moment: specifying more than one class of prefix (keywordsprefix=[2]{/}) is currently not supported. I'd like to avoid having to list all the words that match my description into morekeywords. Is that possible? How? What are the best textbooks to read for the mathematical background you need for modern physics, such as, string theory?  Some subjects off the top of my head that probably need covering:   Differential geometry, Manifolds, etc. Lie groups, Lie algebras and their representation theory. Algebraic topology. Complete references in between the document When we do   \bibliographystyle{style} \bibliography{References.bib}   We get all the references at the end of the document, with some kind of reference/id in the document.   What I need is the complete reference in the document itself (not at the end) and then to be able to write what I want below this reference. For example;  Chaminade, T., Hodgins, J., &amp; Kawato, M. (2007). "Anthropomorphism influences perception of computer-animated characters' actions." Social Cognitive and Affective Neuroscience 2(3): 206-216      - Some text..........      - Some more text.......  Cowley, S. J., Kanda, T. (2005). "Friendly machines: interaction-oriented robots today and tomorrow." Alternation 12(1a): 79-106.      - Some text.....      - Some more text....   How can I do it? Thanks. Understanding a probability paradox Three prisoners are informed by their jailer that one of them has been chosen at random to be executed and the other two are to be freed. Prisoner A asks the jailer to tell him privately which of his fellow prisoners will be set free, claiming that there would be no harm in divulging this information because he already knows that at least one of the two will go free. The jailer refuses to answer the question, pointing out that if A knew which of his fellow prisoners were to be set free, then his own probability of being executed would rise from 1 3 to 1 2 because he would then be one of two prisoners. What do you think of the jailer’s reasoning?  If the jailer refuses to say anything, then the probability that prisoner $A$ is excecuted is $\frac{1}{3}$. If the jailer says to prisoner $A$ that prisoner $B$ will walk free, then $2$ prisoners remain to be considered, $A$ and $C$. One dies, one does not. Heads or tails essentially. $\frac{1}{2}$ ought to be the conditional probability that $A$ dies given that $B$ walks free no? Apparently not though, allegedly the correct answer is still $\frac{1}{3}$. Even my attempt to calculate the correct answer yielded the result $\frac{1}{2}$.   Let $A_D$ and $C_D$ respectively denote the event of $A$ and $C$ dying. Let $B_F$ denote the event that $B$ walks free. Assume that the jailer tells prisoner $A$ that prisoner $B$ will walk free.   Here's my attempt.  $$P(A_D\mid B_F)=\frac{P(A_D\cap B_F)}{P(B_F)}=\frac{P(A_D\cap B_F)}{P((B_F\cap A_D)\cup (B_F\cap C_D))}=\frac{P(A_D)P(B_F\mid A_D)}{P(A_D)P(B_F\mid A_D)+P(C_D)P(B_F\mid C_D)}=\frac{\frac{1}{3}\times 1}{\frac{1}{3}\times 1+\frac{1}{3}\times 1}=\frac{1}{2}$$  What am I doing wrong?  Edit 1: Intuitively I am still troubled but I understand now that $B_F$ may occur even though the jailer does not necessarally say $B$.   Edit 2: I suppose that it makes some sense if the faiths of the prisoners had already been decided before prisoner $A$ asked the jailer the question. If the jailer decides to reveal one of the others who will walk free then that must've been the case. Inverse of function is continuous or not? If $f:I\subseteq \Bbb R \rightarrow \Bbb R$ is injective and everywhere continuous in its domain then $f^{-1}$ is also continuous everywhere. Here  $I$ cannot be discrete set and $f$ is single variable function The above statement is always correct or not? I thought it is always correct. Am I correct or not? This is a pretty simple question, at least it seems like it should be, about sudo permissions in Linux.  There are a lot of times when I just want to append something to /etc/hosts or a similar file but end up not being able to because both &gt; and &gt;&gt; are not allowed, even with root.  Is there someway to make this work without having to su or sudo su into root? Do I need a visa for Paris, if my connecting flight stops for 24 hours in Paris? Do I need visa for Paris, if my connecting flight stops at Paris for 24hrs and I want to visit Paris during that 24hrs? I have US B1 visa. I'll be travelling from San Francisco to Bangalore (India) via Paris. I hold Indian passport. If yes, what is the procedure for that visa? When mounting an NFS share manually using mount and a path of the form &lt;domain/ip&gt;:&lt;path&gt;/&lt;path&gt; or &lt;domain/ip&gt;:/&lt;path&gt;/&lt;path&gt;, umount fails to find the path in /proc/mounts, despite the fact that the path is in fact listed in /proc/mounts.  This is the same problem as in this question:   Steps to reproduce:  # mount --version mount from util-linux 2.24.1 (libmount 2.24.0: debug, assert) # mkdir mountpath # mount 192.168.2.101:/devices mountpath # umount mountpath /home/.../mountpath was not found in /proc/mounts # grep mountpath /proc/mounts 192.168.2.101://devices /home/.../mountpath nfs4 rw,[snip],addr=192.168.2.101 0 0   How can I unmount this mount? I have spent a whole day trying to solve the following problem. Please help if you know how to do this.  I am using natbib (\usepackage[sort&amp;compress,square,comma]{natbib}), and my current citation style looks like [1-4], [5, 8-9].  What is the easiest way to change the citation style to [1]-[4] and [5],[8]-[9]? Displaying multiple fields as labels if one field is null in QGIS? I am having some issues trying to show multiple fields for a single label in QGIS. In QGIS2.6, attempting to display labels for a feature consisting of multiple fields results in an empty label if one of the fields is null. So for example, in the label expression dialog:  concat("Temp Site",'\n',"Notes",'\n',"Function")   will function normally unless one of the fields is null, then it results in no label being shown. Using the '||' operator instead in the expression dialog also results in the same behaviour:  "Temp Site" || '\n'  ||  "Notes" || '\n'  ||  "Function"   Is there a way to display the labels even if one of the fields is null?