the issue I'm having is that the .on(click()) event works with the paragraphs generated through the dialog box, but not when they are created through the textbox entry() method. When I inspect them the IDs are correct and in the same format as the dialog-created paragraphs, but they don't work with the click event. Clicking on the dynamically created paragraphs doesn't even fire the click event at all. What do I need to do to solve this? thanks.  HTML:       &lt;html&gt;  &lt;head&gt;     &lt;link rel="stylesheet" type="text/css" href="stylesheet.css"&gt;     &lt;!-- Latest compiled and minified CSS --&gt;     &lt;link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"&gt;      &lt;!-- jQuery library --&gt;     &lt;script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"&gt;&lt;/script&gt;     &lt;script language="javascript" type="text/javascript" src="main.js"&gt;&lt;/script&gt; &lt;/head&gt;  &lt;body&gt;       &lt;input type="text" id="txtTask" onkeydown="entry();"/&gt;      &lt;div id="taskBox" class="debugBox"&gt;        &lt;/div&gt;  &lt;/body&gt;     JS:  var tasks = []; var content = "";  $(document).ready(function (){  for(var i = 0; i &lt; 5; i++) {      content = prompt("Enter a task", i);      if(content != "") {          addTask(content, "yellow");      }; };  for(var i = 0; i &lt; 5; i++) {      console.log(tasks[i].Content); };      $( 'p' ).on( "click", function() {      console.log("clicked");     removeTask(this.id);  });    });    function entry()  { if (event.keyCode == 13) {      var ent = txtTask.value.toString();      if(ent != "") {          addTask(ent, "yellow");      };      console.log("input = " + txtTask.value);     txtTask.value='';  };  };  function addTask(content, color) { tasks[tasks.length] = {     Content: content,     Color: color,     isActive: true };  $('#taskBox').append('&lt;p id="' + tasks[tasks.length - 1].Content + '"&gt;' + tasks[tasks.length - 1].Content + '&lt;/p&gt;'); };  function removeTask(content) { for(var i = 0; i &lt; tasks.length; i++){      if(tasks[i].Content === content &amp;&amp; tasks[i].isActive === true) {          tasks[i].isActive === false;          $('#' + tasks[i].Content).remove();     }  }; };
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.
Is there a systematic way to obtain all conserved quantities of a system? I'd like to know whether, given a system, there's a way to obtain all the conserved quantities. For instance if the system consists of electric and magnetic fields, the fields must satisfy Maxwell's equations. These equations are invariant under many transformations (Lorentz transformation, rotations, spatial and temporal translations, etc. By the way is there a way, maybe from group theory, to find all the possible transformations that leaves the equation(s) invariant?) which imply as many conserved quantities thanks to Noether's theorem. In wikipedia I can see an equation that seems to give all the conserved quantities () but it involves the Lagrangian and I'm not sure whether the formula is valid for all systems whose Lagrangian is possible to obtain. If $\omega \in \Omega^q(M)$, and $(\omega|_{U})_p = 0$, is $\omega_p = 0$? A friend offered me a brain teaser to which the solution involves a $195$ pound man juggling two $3$-pound balls to traverse a bridge having a maximum capacity of only $200$ pounds. He explained that since the man only ever holds one $3$-pound object at a time, the maximum combined weight at any given moment is only $195 + 3=198$ pounds, and the bridge would hold.  I corrected him by explaining that the acts of throwing up and catching the ball temporarily make you 'heavier' (an additional force is exerted by the ball to me and by me onto the bridge due to the change in momentum when throwing up or catching the ball), but admitted that gentle tosses/catches (less acceleration) might offer a situation in which the force on the bridge never reaches the combined weight of the man and both balls.  Can the bridge withstand the man and his balls? How to find users by name I have a whole bunch of people I would love to follow or at least check out on Stack Overflow. I know them from places like Github as well as personal friends. However I am having a really hard time finding them even though I know e.g. their Gmail address and that they use OpenID via Gmail to login and their full name.   How come this is so painful? Note that I don't want to have to fuzz around with the data explorer just to find a friend of mine on Stack Overflow. What am I missing? Is it just not there or just not working properly? I currently have an ec2 &quot;t2.nano&quot; instance up and running. I would like to switch to a &quot;t2.micro&quot;. In order to do that, I need to stop the instance. But I would lose my IPv4 address in the process. And I do not want that (because I have several ssh tunnels up and running from rasps in the wild that are currently hard coded to connect to this IPv4 address). I decided to create an Elastic IP address. But I understand that by creating an Elastic IP address and assigning it to my current ec2 instance, I would lose my current IPv4 address too. Is it possible to create an Elastic IP address from the current IPv4 address of my ec2 instance? If so, how can I do this operation? Are there good reasons why it's a better practice to have only one return statement in a function?   Or is it okay to return from a function as soon as it is logically correct to do so, meaning there may be many return statements in the function? "Nobody want to go there," or "nobody wants to go there"? In English, the number 0 is treated as plural. It is then:   0 seconds 1 second    1.2 seconds   2 seconds     Shouldn't it be "nobody want to go there," instead of "nobody wants to go there"?  I also saw in TOEFL that "any __" should be used with a singular.  But I see it very common that it is a plural also.  Why is that?  (updated: example, "we don't have any apples any more" vs "If you get any apple, please let me know.") Is there an open dense set $S \subset [0,1]$ such that $m(S)<1$? $m$ is the Lebesgue measure. I was thinking that: $\Bbb Q$ is dense and $m(\Bbb Q)=0&lt;1$ but it fails to be open, but maybe I could construct an open set from this fact, or also using that $(0,1)$ is a dense and open subset but $m(0,1)=1$.   Any hints or ideas will be very appreciated. Thanks. I am trying to think of a non-colloquial word or phrase that means "practice what you preach." I would appreciate any suggestions. Thank you! pgfplots: lines and markers in different colors With pgfplots, I am creating a simple coordinate plot with error bars like this:    \documentclass[crop,10pt]{standalone} \usepackage[english]{babel} \usepackage{pgfplots}      \begin{document}%         \setlength{\linewidth}{246pt}%              \begin{tikzpicture}             \begin{axis}[             width=\linewidth,             ytick pos = left,             xtick pos = left,             clip=false,             axis on top,             tick align = outside,             yticklabel style={%             /pgf/number format/fixed,             /pgf/number format/precision=1,             /pgf/number format/fixed zerofill         },             ytick scale label code/.code={},             xlabel={X},             ylabel={Y},     ]             \addplot[mark=*]             plot[             error bars/.cd,             y dir=both,             y fixed=0.0001     ]             coordinates{(1,0.0005) (1.1,0.0013) (5,0.0015)};             \end{axis}             \end{tikzpicture}     \end{document}   In the original plot I have a lot more points. I would now like the line and the markers (including the error bars) to have different colors to better distinguish the line from the error bars. Is that somehow possible? The only way I found so far is to plot the data just as a line in one color and then plot it again just as markers in another color. This works, but I guess there must be some better solution to this. Thanks for the support, John Differential equation $y''=\frac{y'}{2\sqrt y}$ Git for beginners: The definitive practical guide Ok, after seeing , I have decided to skip to the end and go with .  So what I need is a beginner's practical guide to Git.  "Beginner" being defined as someone who knows how to handle their compiler, understands to some level what a  is, and has touched source control without understanding it very well.  "Practical" being defined as this person doesn't want to get into great detail regarding what Git is doing in the background, and doesn't even care (or know) that it's distributed.  Your answers might hint at the possibilities, but try to aim for the beginner that wants to keep a 'main' repository on a 'server' which is backed up and secure, and treat their local repository as merely a 'client' resource.  So:  Installation/Setup    How do you set up Git?  Try to cover Linux, Windows, Mac, think 'client/server' mindset.         Working with the code          How do you handle binary files (visio docs, for instance, or compiler environments)? How do you merge files changed at the "same time"?    Tagging, branching, releases, baselines    How do you pull a particular 'release'?   How do you resolve conflicts and complete the merge? How do you merge parts of one branch into another branch?        Other   Describe and link to a good GUI, IDE plugin, etc. that makes Git a non-command line resource, but please list its limitations as well as its good.    - Cross platform, included with Git  - Cross platform history viewer, included with Git  - Mac OS X  - Mac OS X history viewer  - Cross platform, commercial, beta  - console GUI for Linux  - GUI for Windows, Linux  - package for Windows, includes friendly GUI  Any other common tasks a beginner should know?     How do I work effectively with a subversion repository set as my source control source?   Other Git beginner's references                 Delving into Git     (and )    I will go through the entries from time to time and 'tidy' them up so they have a consistent look/feel and it's easy to scan the list - feel free to follow a simple "header - brief explanation - list of instructions - gotchas and extra info" template.  I'll also link to the entries from the bullet list above so it's easy to find them later. I have an Excel file containing data collected over many years as latitude and longitude coordinates for archaeological sites. How can I import it into QGIS as a new layer? All of my Firefox add-ons have been disabled suddenly, how can I re-enable them? Why didn't Gandalf or Frodo Fly to Mount Doom? Why didn't Gandalf use his eagles to fly over Mount Doom and drop the ring? I know he feared what he would do if the ring overpowered him, so why not just give Frodo an eagle? And, if there would be too much risk in flying the ring to Mordor, couldn't the eagles fly them part of the way?  Why risk it with such a long walk; far less risky to fly over most of the journey. long long implementation in 32 bit machine As per c99 standard, size of long long should be minimum 64 bits. How is this implemented in a 32 bit machine (eg. addition or multiplication of 2 long longs). Also, What is the equivalent of long long in C++. How can I get query string values in JavaScript? Number Theory: Find all solutions of $\phi(n)=16$ and $\phi(n)=24$ I have this homework problem assigned and I'm a little confused in solving it:  Find all solutions of $\phi(n)=16$ and $\phi(n)=24$ (where $\phi(n)$ is the Euler phi-function).  The hint that's provided says:  If $n=p_1^{k_1}p_2^{k_2}\cdots p_r^{k_r}$ satisfies $\phi(n)=k$, then $n=\frac{k}{\prod (p_i-1)}\prod p_i$. Thus the integers $d_i=p_i-1$ can be determined by the conditions (1) $d_i\mid k$, (2) $d_i+1$ is prime, and (3) $\frac{k}{\prod d_i}$ contains no prime factor not in $\prod p_i$.  I'm ok with proving the statements in the hint and I know how to get them, but I'm not sure how to apply them to solve the problem. $4$ letter words taken from the letters of CONCENTRATIONS How many words with or without meaning can be made from the letters of the word CONCENTRATIONS by taking $4$ letters at a time?  There are  $14$ letters total present in the word. $4$ letters can be picked in $14\choose 4$ ways. $4$ letters can be arranged in $4!$ ways. So ideally answer has to be ${14\choose 4} * 4!$. But I know this answer is wrong because some letters are repeating. How do I solve this then? I appreciate any help. I inherited a project using SQL Server 2005.  Recently there were some performance problems and I started looking at the indexes, and found  _dta_index_survey_25_135059617__K1_K10_K19:     id ASC, sent_date ASC, group_id ASC   and  _dta_index_survey_21_364632442__K18_K1_K2_K9:     group_id ASC, id ASC, campaign_id ASC, sent_date ASC   which appears to be generated by some kind of automatic performance tuning tool.  I think SQL Server comes with something like that but I'm not familiar with it.  Anyway, id is the primary key, and what I'm trying to understand here is how it could possibly be beneficial to include the primary key within a secondary index... because you have to have the leftmost pieces of information to use an index and if you know id then you've got the row anyway.  Can someone explain why a tool would have generated these indexes and if there's any point in keeping them?  Just because the indexes are getting used doesn't mean they're a good design.  SQL Server is using the wrong indexes lately, and I'm trying to determine why. More specifically, queries against this table that ran in milliseconds a month ago are now taking multiple seconds.  The table is huge (4M rows), and growing steadily, but at the same pace it's been going at for years.  Almost every query joins across group_id or campaign_id.  Often both.  The application almost never specifically selects or sorts by the PK, but I could see how ID could be useful when comparing or merging lists of IDs within the database engine.  ... But id is also an identity column, and an index holds lists of row ids, so it still seems redundant to have the ID in the key when it's also in the index "buckets".  And the additional fields could still be covered by the index without being part of the key.  I discovered that (id, sent_date, group_id) hardly ever gets read.  Meanwhile (group_id, id, campaign_id, sent_date) is one of the hottest indexes.  Next I found that an index which I thought was pretty reasonable (campaign_id, sent_date, group_id, id) also has a index_columns_include of every other column in the table, and occupies more space than the primary clustered index on id!  (but it's also pretty hot...)  Surely I can replace it with a simple (campaign_id, sent_date, group_id)?