Note that there are some explanatory texts on larger screens.

plurals
  1. POAre JQuery selectors limited to the current modal window? I am having problems retrieving data from a modal behind the current one
    primarykey
    data
    text
    <p>I am using JQuery's data method to store some information in an app.</p> <p>Setting the data and then checking it is set is working fine.</p> <pre><code>var my_data = "sample data"; var data_location = $("#data_location"); $.data(data_location, "my_data", my_value); console.log("data: " + $.data(data_location, "my_data")); </code></pre> <p>This would output to my console: "sample data".</p> <p>The data is being stored to a div (#data_location) in a modal dialog that is visible.</p> <p>The app then sometimes displays a second modal dialog over top of the first (data containing) modal window.</p> <p>Once the second modal dialog is displayed I don't seem to be able to retrieve the data.</p> <p>From the second dialog I am running:</p> <pre><code>var data_location = $("#data_location"); console.log("data: " + $.data(data_location, "my_data")); </code></pre> <p>When this is run with the second modal dialog display it outputs "undefined".</p> <p>Is there something limiting my JQuery selector to the current modal dialog?</p> <p>Or am I missing something else?</p> <p>Thanks for your assistance.</p> <p>JS fiddle demonstrating the issue:</p> <p><a href="http://jsfiddle.net/tNEAX/36/" rel="nofollow">http://jsfiddle.net/tNEAX/36/</a></p> <p>Interestingly, if I set the data location outside of the two click events it does work. Unfortunately I can't do this because I am working between multiple js files. You can see it working here: <a href="http://jsfiddle.net/tNEAX/39/" rel="nofollow">http://jsfiddle.net/tNEAX/39/</a></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload