Here is my current code:  jQuery(document).ready(function($) {   $("#edit-name").change(function() {     $("#Membership_UserName").val($(this).val());   });   $("#edit-pass-pass1").change(function() {     $("#Membership_PassWord").val($(this).val());   });   $("#edit-pass-pass2").change(function() {     $("#.Verify_Password").val($(this).val());   }); });   Everything works fine, except for updating the value of the element whose ID is .Verify_Password. The reason seems pretty apparent to me (that jQuery is getting confused after seeing # and . right next to each other) but maybe that's wrong...  Regardless, the ID can't be changed because it's being sent to a remote endpoint and it needs to match on that end.  So my question is: is there a way to tell jQuery that .Verify_Password is an ID (and not a class)?
62871
If my html looked like this:  &lt;td class="controlCell"&gt;     &lt;input class="inputText" id="SearchBag.CompanyName" name="SearchBag.CompanyName" type="text" value="" /&gt; &lt;/td&gt;   How could I select #SearchBag.CompanyName with JQuery? I can't get it to work and I fear it's the dot that's breaking it all. The annoying thing is that renaming all my id's would be a lot of work, not to mention the loss in readability.  Note: Please let's not start talking about how tables are not made for lay-outing. I'm very aware of the  and try hard to use it as much as possible.
49395
In jQuery when you do this:  $(function() {    alert("DOM is loaded, but images not necessarily all loaded"); });   It waits for the DOM to load and executes your code. If all the images are not loaded then it still executes the code. This is obviously what we want if we're initializing any DOM stuff such as showing or hiding elements or attaching events.  Let's say though that I want some animation and I don't want it running until all the images are loaded. Is there an official way in jQuery to do this?  The best way I have is to use &lt;body onload="finished()"&gt;, but I don't really want to do that unless I have to.  Note: There is a  in Internet Explorer which actually does wait for all images to load before executing code inside $function() { }. So if you're using that platform you'll get the behavior I'm looking for instead of the correct behavior described above.
58463
Does anyone know of an easy way to escape HTML from strings in ?  I need to be able to pass an arbitrary string and have it properly escaped for display in an HTML page (preventing JavaScript/HTML injection attacks).  I'm sure it's possible to extend jQuery to do this, but I don't know enough about the framework at the moment to accomplish this.
48201
Environment I'm logging in using the OpenID from  and using Chrome 31.0.1650.57 m if that matters. Steps to reproduce: Log in to  and , for example, like: DECLARE @MyUserID INT = ##UserID:int##  SELECT TOP 1     Id AS [Post Link],     Score AS [Score],     CreationDate AS [Creation Date] FROM     Posts WHERE     OwnerUserId = @MyUserID AND     PostTypeId IN (2, 3) ORDER BY     CreationDate DESC  Then press the Run Query button and see if the UserID field is filled with your own user ID like shown in the below screenshot:  Question: Did something changed on the ##UserID## parameter (for example, that it's not supported anymore)?  If so, then there is an outdated  paragraph about it (What's the point of logging in). If not, it is a bug which is there about three days (I've been waiting since I noticed that you were going to do some changes to Data Explorer, but it remains there, hence my question).
69939
I want to handle F1-F12 keys using JavaScript and jQuery.  I am not sure what pitfalls there are to avoid, and I am not currently able to test implementations in any other browsers than Internet Explorer 8, Google Chrome and Mozilla FireFox 3.  Any suggestions to a full cross-browser solution? Something like a well-tested jQuery library or maybe just vanilla jQuery/JavaScript?
42629
For instance in the snippet below - how do I access the h1 element knowing the ID of parent element (header-inner div)?  &lt;div id='header-inner'&gt;     &lt;div class='titlewrapper'&gt;        &lt;h1 class='title'&gt;        Some text I want to change       &lt;/h1&gt;     &lt;/div&gt;  &lt;/div&gt;   Thanks!
35183
I'm pulling items out of the DOM with jQuery and want to set a property on an object using the id of the DOM element.   Example  const obj = {}  jQuery(itemsFromDom).each(function() {   const element = jQuery(this)   const name = element.attr('id')   const value = element.attr('value')    // Here is the problem   obj.name = value })   If itemsFromDom includes an element with an id of "myId", I want obj to have a property named "myId". The above gives me name.  How do I name a property of an object using a variable using JavaScript?
14915
When creating the id attributes for HTML elements, what rules are there for the value?
121119
I have a function that sets a user to confirmed after they login to my site for the first time. However, whenever I run this function and I log out and try to log back in the password doesn't work anymore and I have to do a manual reset in the database. I can't seem to find what would cause a change in the password. Any advice?  Note that I am using mongodb.  function update_profile($uid,$attribute_name,$attribute_value,$arrayaction=NULL) {     // update some user property     $existing = user_load($uid);     $edit = (array) $existing;      //Update profile iformation     if(!empty($arrayaction))     {         if(strtolower($arrayaction) == 'push')         {             array_push($edit[$attribute_name]['und'][0],$attribute_value);         }         else if (strtolower($arrayaction) == 'unset')         {             if(($key = array_search($attribute_value, $edit[$attribute_name]['und'][0])) !== false) {                unset($edit[$attribute_name]['und'][0][$key]);             }         }     }     else     {         $edit[$attribute_name]['und'][0] = $attribute_value;     }      //Make the changes to the user     user_save($existing, $edit); }  function module_user_login(&amp;$edit,$account) {     if ($account-&gt;access == 0) {         update_profile($account-&gt;uid,'field_confirmed',array('value'=&gt;1),NULL);     } }
118435
I want to update field on click of ok in the javascript popup message. Is there any way that i can do in custom button javascript code  like we have checkbox field and when i click on ok in the message the checkbox need to be checked in the backend  thanks in advance
39794
I want to use jQuery with asp.net webfoms.  Do I need to get a special toolkit so the .net controls spit out friendly Control ID's?  Reason being, I don't want to write javascript referencing my html ID's like control_123_asdfcontrol_234.  Has this been addressed in version 3.5?  (I remember reading you have to get some special dll that makes ID's friendly).
92658
I'm using Jquery's toggle event to do some stuff when a user clicks a checkbox, like this:  $('input#myId').toggle( function(){ //do stuff   }, function(){ //do other stuff     } );   The problem is that the checkbox isn't being ticked when I click on the checkbox. (All the stuff I've put into the toggle event is working properly.)  I've tried the following:  $('input#myId').attr('checked', 'checked');   and  $(this).attr('checked', 'checked');   and even simply  return true;   But nothing is working. Can anyone tell me where I'm going wrong?  Edit - thanks to all who replied. Dreas' answer very nearly worked for me, except for the part that checked the attribute. This works perfectly (although it's a bit hacky)  $('input#myInput').change(function () {     if(!$(this).hasClass("checked"))     {         //do stuff if the checkbox isn't checked         $(this).addClass("checked");         return;     }      //do stuff if the checkbox isn't checked     $(this).removeClass('checked'); });   Thanks again to all who replied.
4670
I have an element that already has a class: &lt;div class=&quot;someclass&quot;&gt;     &lt;img ... id=&quot;image1&quot; name=&quot;image1&quot; /&gt; &lt;/div&gt;  Now, I want to create a JavaScript function that will add a class to the div (not replace, but add). How can I do that?
19582
If I set a CSS value on a specific element using:  $('#element').css('background-color', '#ccc');   I want to be able to unset that element-specific value and use the cascaded value, along the lines of:  $('#element').css('background-color', null);   But that syntax doesn't seem to work – is this possible using another syntax?  Edit: The value isn't inherited from the parent element – the original values comes from an element-level selector. Sorry for any confusion!
67655
Does anyone know how to select an item in the DOM by ID with jQuery, when that ID has a space?   For example, the ID of my item would be  &lt;div id="content Module"&gt;Stuff&lt;/div&gt;   How would I select this with jQuery?   If I just do   $("#content Module").whatever()    jQuery will try to find an item with both the ID of content and the ID of Module, which is not what I am looking for.  I should add that I am working with an old code base where these two word ids are used extensively, so going through and changing all the IDs would be bad.
39853
I am trying to pass a variable into jq like this '.Linux.date.$var' so far I have tried quoting them by name which is working fine. But I want to use variable to call them.  I have this, which is working fine  exectime=$(date -d now);     cp $check_exec_history $check_exec_history.tmp     jq --arg key1 true --arg key2 "$exectime" --arg name "$name" '.Linux.script_executed.first = $key1 | .Linux.date_executed.first = $key2' $check_exec_history.tmp &gt; $check_exec_history;      rm $check_exec_history.tmp;   I want to get to this, but not working:  name=first; exectime=$(date -d now); cp $check_exec_history $check_exec_history.tmp jq --arg key1 true --arg key2 "$exectime" --arg name "$name" ".Linux.script_executed.$name = $key1 | .Linux.date_executed.$name = $key2" $check_exec_history.tmp &gt; $check_exec_history;  rm $check_exec_history.tmp;   I came this far: using this answer  But I am not sure where I am doing mistake.  name=first; exectime=$(date -d now);     cp $check_exec_history $check_exec_history.tmp     jq --arg key1 true --arg key2 "$exectime" --arg name "$name" '.Linux.script_executed.name==$name = $key1 | .Linux.date_executed.name==$name = $key2' $check_exec_history.tmp &gt; $check_exec_history; rm $check_exec_history.tmp;
100032
How exactly do you make an auto-refreshing div with JavaScript (specifically, jQuery)?  I know about the setTimeout method, but is it really a good practice ? Is there a better method?  function update() {     $.get("response.php", function(data) {         $("#some_div").html(data);     });     window.setTimeout("update();", 10000); }