Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
1,329,155
1,329,156
Get an array of list element contents in jQuery
<p>I have a structure like this:</p> <pre><code>&lt;ul&gt; &lt;li&gt;text1&lt;/li&gt; &lt;li&gt;text2&lt;/li&gt; &lt;li&gt;text3&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>How do I use javascript or jQuery to get the text as an array?</p> <pre><code>['text1', 'text2', 'text3'] </code></pre> <p>My plan after this is to assemble it into a string, probably using <code>.join(', ')</code>, and get it in a format like this:</p> <pre><code>'"text1", "text2", "text3"' </code></pre>
javascript jquery
[3, 5]
4,736,644
4,736,645
Convert text url to a clickable url
<p>I am allowing people to post comments using a textarea field and sometimes they post urls. What I need to do is to convert this url from db before displaying it as a real clickable link, but without allowing html tags. I would prefer to do it using php or jquery if possible. I thought about using something like [link][/link] but I need to do it without any extra effort from the website member. Any ideas please??</p> <p>example :</p> <pre><code>[link]http://www.google.com[/link] </code></pre>
php jquery
[2, 5]
5,279,210
5,279,211
difference between c# and asp.net/c#
<p>do i need to be as strong in c# as an asp.net/c# developer as i would as a c# desktop application developer? there seems to be much less c# coding involved when developing asp.net websites than desktop applications. are there certain things in c# that aren't used as often when used in asp.net websites than in desktop software? i was just wondering if there were different ways of approaching learning the language depending on how it will be applied. thanks.</p>
c# asp.net
[0, 9]
3,514,937
3,514,938
automatic form post data
<p>I have a form with lots of data to be posted, so i was wondering if there is any way to get all the data to be posted automatically.</p> <p>like for example i sent data this way</p> <pre><code>$.ajax({ type: 'post', url: 'http://mymegafiles.com/rapidleech/index.php', data: 'link=' + $('#link').val() + '&amp;yt_fmt' + $('#yt_fmt').val(), }); </code></pre> <p>but there are so many fields that it doesnt look a good idea to me.</p> <p>Thank You.</p>
javascript jquery
[3, 5]
4,424,088
4,424,089
jQuery Draggable / Droppable - Remove all dropped 'items'
<p>Is it possible to remove all dropped 'items' on a droppable div by pressing a single button?</p> <p>Thanks, LS</p> <pre><code>$("#wrapper").droppable({ accept: '.shape', drop: function(event, ui) { $(this).append($(ui.helper).clone()); $("#wrapper .shape").addClass("item"); $(".item").removeClass("ui-draggable shape"); $(".item").draggable({ containment: '#wrapper' }); } }); $("#trash").droppable({ accept: '.item', drop: function(event, ui) { $(ui.draggable).remove(); } }); </code></pre> <p>I've created a div called trash, so when the items are dropped into this they are removed. I need similar functionality to this but when a button is pressed it removes all of the dropped shapes without having to drag them onto the trash div.</p>
javascript jquery
[3, 5]
3,122,865
3,122,866
How to change ImageButton image onclick. My code is not working
<p>I can't figure out why my code isn't working. I've got an ImageButton declared and I'm when the user clicks on the image, I was to increment <code>valHomeFouls</code>. When <code>valHomeFouls &gt; 5</code> then it is reset to 0.</p> <p>For some reason it is not changing the image onClick.</p> <pre><code> // set the onClick listener for the foulsHome ImageButton btnFoulsHome.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { valFoulsHome++; if( valFoulsHome &gt; 5 ) valFoulsHome = 0; switch( valFoulsHome ) { case 5: btnFoulsHome.setImageResource(R.drawable.fouls5); case 4: btnFoulsHome.setImageResource(R.drawable.fouls4); case 3: btnFoulsHome.setImageResource(R.drawable.fouls3); case 2: btnFoulsHome.setImageResource(R.drawable.fouls2); case 1: btnFoulsHome.setImageResource(R.drawable.fouls1); case 0: btnFoulsHome.setImageResource(R.drawable.fouls0); } } }); </code></pre> <p>Can anyone see why?</p>
java android
[1, 4]
3,714,240
3,714,241
Why can't I use an int from a spinner in the same class?
<p>Ok so I am working on an android app and I have implanted spinners... I have a total of four spinners and I have learned that if the spinner reads the options from the strings it has a defined number for the selection(i.e the first option is "0" next is "1" and so on)</p> <p>I have the following code for the spinner</p> <pre><code> Spinner a = (Spinner) findViewById(R.id.spinner1); a.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @Override public void onItemSelected(AdapterView adapter, View v, int a, long lng) { // do something here Toast.makeText(adapter.getContext(), "You selected: " + a, Toast.LENGTH_SHORT).show(); } @Override public void onNothingSelected(AdapterView arg0) { // do something else } }); </code></pre> <p>and another one but with the int "b"</p> <p>but later on in the same class I want to use some maths to get e=a,b (i.e if a=6 and b=5 e=65, or a=4 and b=3 e=43) This is easily done by executing </p> <pre><code>int e=a*10+b; </code></pre> <p>The problem is I want to display this when you press a button, so I have the following code</p> <pre><code>public void Calc(View v) { int e = a * 10 + b; Toast.makeText(this, "Value: " + e, Toast.LENGTH_LONG).show(); } </code></pre> <p>but results in the error ""a" &amp; "b" cannot be resolved to a variable" why is this and how can I create a button that will be able to read these variables?</p>
java android
[1, 4]
5,510,985
5,510,986
Android : Several activities sharing common code
<p>I have an Android application composed by several Activities. Most of them need to check whether an active network is available or not:</p> <pre><code>public boolean isNetworkAvailable() { ConnectivityManager cm = (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE); TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); ... } </code></pre> <p>I would like to move that code to a helper class in order to avoid the need to write that code in every Activity, but calls to <code>getSystemService</code> are only allowed from an Activity.</p> <p>The other alternative is to move that code to a parent activity use inheritance but:</p> <ol> <li>Every activity already extends from android.app.Activity</li> <li>Some of my activities already extend from a common my.package.BaseActivity (Activity &lt;- BaseActivity &lt;- XXXActivity)</li> </ol> <p>so I don't like this idea very much.</p> <p>What do you recommend in this case? Is there any other alternative?</p>
java android
[1, 4]
1,030,426
1,030,427
jQuery equivalent selectors
<p>Are the following exactly equivalent? Which idiom do you use and why?</p> <pre><code>$('#form1 .edit-field :input') $('#form1 .edit-field').find(':input') $('.edit-field :input', '#form1') $(':input', '#form1 .edit-field') </code></pre>
javascript jquery
[3, 5]
3,467,615
3,467,616
validating dropdownlist in gridview using javascript
<p>I have created a gridview with dropdownlist in asp.net(c#).i want to validate dropdownlist using jvascript.if i dont select anything from dropdownlist that time script shud display a message.i don know how to get the name or id of that dropdownlist</p>
c# asp.net
[0, 9]
433,674
433,675
Hyperlink to a part of a page that doesn't have an identifier
<p>I want to create a hyperlink that goes directly to the data parameter of the $.ajax command. But the closest hash tag that I can find is <a href="http://api.jquery.com/jQuery.ajax/#jQuery-ajax-settings" rel="nofollow">this one</a>.</p> <p>Q: Is there a way to have the browser navigate down to a part where there is no id= or name= attribute? I'm thinking of maybe including some JavaScript into the url.</p>
javascript jquery
[3, 5]
647,227
647,228
JQuery - using .on with element insertion
<p>I have a function which creates a tooltip for specific objects. Currently, I am running a tooltip function after ajax insertions to create and append the new tooltip objects. I am curious if there is a way to use .on() to auto-run the tooltip function on insertion, rather than manually running it. </p> <p>For instance: </p> <pre><code> $('[title]').on('inserted', function(){ tooltip(this); }); </code></pre> <p>I did some reading and it looks like custom triggers might be the way to go, but I'd love if it something like this existed :)</p>
javascript jquery
[3, 5]
1,362,343
1,362,344
Problems defining a good hide/unhide jQuery function for dynamic divs
<p>A while ago I used this simple function to hide/unhide <code>divs</code>':</p> <pre><code>$(document).ready(function() { $('#job_desc').hide(); $('#slick-toggle').click(function() { $('#job_desc').toggle(400); return false; }); }); </code></pre> <p>As you can see I'm just hiding the <code>div</code> with the id <code>job_desc</code> when the document is ready, also creating a function that toggles the state of the <code>div</code> when the user clicks on the link with the id <code>slick-toggle</code>.</p> <p>Well the times change, now I'm generating the <code>div</code>'s using a php loop like:</p> <pre><code>while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { echo '&lt;div id="job_desc['.$row["id_exp"].']"&gt;'.$job_desc.'&lt;/div&gt;' } </code></pre> <p>At this point I'm stuck, I know I need to generate not only the <code>div</code>'s dynamically but also the <em>toggle</em> buttons for every <code>div</code>.</p> <p>I really don't know how to:</p> <ol> <li>Change my jquery function in order to work with dynamically generated <code>div</code>'s</li> <li>How to hide all the <code>div</code>'s when document ready.</li> </ol>
php javascript jquery
[2, 3, 5]
4,052,536
4,052,537
jquery Ajax URl issue
<p>I have looked around quite a bit and it seems absolute urls is the way to go here. I have no problem in chrome but firefox and IE IE still wants to redirect fully to the wrong page.</p> <p>my states:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $('#page_submit').click(function () { event.preventDefault(); $('.standard span').hide(); var pw = $("input#pw").val(); if (pw == "") { $("span#pw_err").show(); $("input#pw").focus(); return false; } var pw2 = $("input#pw2").val(); if (pw2 == "") { $("span#pw2_err").show(); $("input#pw2").focus(); return false; } if (pw != pw2) { $("span#match_err").show(); $("input#pw2").focus(); return false; } var data = 'pw=' + pw + '&amp;pw2=' + pw2; $('.standard input').attr('disabled','true'); $('.loading').show(); $.ajax({ url: "/members/includes/change.php", type: "GET", data: data, cache: false, success: function (html) { //hide the form $('#pw_form').fadeOut('slow'); //display results $('#pw_form_result').fadeIn('slow'); $("#pw_form_result").html(html); } }); return false; }); }); &lt;/script&gt; </code></pre> <p>the structure of the file I am trying to access is:</p> <blockquote> <p>www.site.com/members/includes/change.php</p> </blockquote> <p>Not sure what the cause is really. I know the jquery initiator is working because i can summon alert calls to and from the function itself.</p> <h2>edit</h2> <p>after commenting out</p> <blockquote> <p>event.preventDefault();</p> </blockquote> <p>it seems to function right? everything I had read before said this was a necessary piece however.</p>
php javascript jquery
[2, 3, 5]
2,743,346
2,743,347
Can't show the element when its class or id contains dots
<p>I must have class which contains dots, but then jQuery doesn't work. What should I do? Example: <a href="http://jsfiddle.net/9KYmx/" rel="nofollow">http://jsfiddle.net/9KYmx/</a></p> <pre><code>&lt;div style="display: none" class="dfv.png"&gt; text &lt;/div&gt; $(document).ready(function() { $('.dfv.png').show(); }) </code></pre> <p>P.S. ID also doesn't work.</p>
javascript jquery
[3, 5]
4,832,589
4,832,590
php echoing javascript call
<p>I am a newbi to webdesign/php and javascript and I am having a problem. Please look at this code:</p> <pre><code> &lt;script type="text/javascript"&gt; &lt;!-- function thanksDiv(){ document.getElementById("myThanksDiv").style.display ='block'; } function hideDiv(id){ document.getElementById(id).style.display='none'; } //--&gt; &lt;/script&gt; &lt;form id="contacts-form" method="post" action="email.php" target="myiframe"&gt; &lt;fieldset&gt; &lt;div class="alignright"&gt;&lt;a href="#" onClick="document.getElementById('contacts-form').submit()"&gt;Send Your Message!&lt;/a&gt;&lt;/div&gt; &lt;/fieldset&gt; &lt;/form&gt; &lt;iframe name="myiframe" id="myiframe" src="" width=1 height=1 style="visibility:hidden;position:absolute;"&gt;&lt;/iframe&gt; &lt;div id="myThanksDiv" style="width:200px;height:150px;position:absolute;left:50&amp;#37;; top:20px; margin-left:-100px;border:1px solid black; background:#fff;display:none;padding:20px;"&gt;Thanks! &lt;br /&gt;Your message was sent.&lt;/div&gt; </code></pre> <p>and in email.php:</p> <pre><code>echo '&lt;script type="text/javascript"&gt;' , thanksDiv();' , '&lt;/script&gt;'; ?&gt; </code></pre> <p>The idea is that when I click on 'Send Your Message' I should see a box saying 'message was sent', but I don't.</p> <p>If I don't go through the email.php page and I just call thanksDiv from the form submit link it works. Any idea why?</p>
php javascript
[2, 3]
1,614,227
1,614,228
Two conditionals inside an if statement (jQuery)
<p>I'm trying to add an if statement which checks if the image is wider than 199px and if it hasn't got a &lt; a > parent element. <strong>This works:</strong></p> <pre><code> $('div.post_body').each(function() { $(this).find('img').each(function () { var img = $(this); if (img.is('a') !== true) { img.wrap($('&lt;a/&gt;').attr('href', img.attr('src')).addClass('lightview limg')); } }); }); </code></pre> <p><strong>This works</strong></p> <pre><code> $('div.post_body').each(function() { $(this).find('img').each(function () { var img = $(this); if (img.width() &gt; 199) { img.wrap($('&lt;a/&gt;').attr('href', img.attr('src')).addClass('lightview limg')); } }); }); </code></pre> <p><em><strong>This DOESN'T work:</em></strong></p> <pre><code> $('div.post_body').each(function() { $(this).find('img').each(function () { var img = $(this); if ((img.width() &gt; 199) &amp;&amp; (img.is('a') !== true)) { img.wrap($('&lt;a/&gt;').attr('href', img.attr('src')).addClass('lightview limg')); } }); }); </code></pre> <p>Can someone help please?</p>
javascript jquery
[3, 5]
4,902,203
4,902,204
replacing chars using jQuery
<p>I am trying to replace all special characters except alphanumerics using js.</p> <pre><code>function checkWholeString(string,len){ if(string != null &amp;&amp; string != ""){ var regExp = /^[A-Za-z0-9-]+$/; for(var i=0; i &lt; string.length; i++){ var ap = string.charAt(i); if(!ap.match(regExp)){ string = string.replace(ap," "); } } return jQuery.trim(string); } } </code></pre> <p>trouble is when I am holding for example "a" key pressed and while I am still holding it I will press another key it will add blank spaces to the text.</p> <p>Is there any chance to improve the code to get rid of this? Any help would be most welcome.</p> <p>Thanks Pete </p>
javascript jquery
[3, 5]
3,923,015
3,923,016
Getting the next element in a div with jquery
<p>Say that we have this html code</p> <pre><code>&lt;div id="test"&gt; &lt;h2&gt;Title&lt;/h2&gt; &lt;p&gt;lorem ipsum&lt;/p&gt; &lt;/div&gt; </code></pre> <p>And this jQuery</p> <pre><code>$("#test h2").text("Changed Title"); </code></pre> <p>Now what is the correct way to continue down to the <code>&lt;p&gt;</code> and also change it's text, without going up one level. Like <code>next()</code> will only look for the next h2, but is there something that gets the sibling independent of element type. Something like <code>next("p");</code> maybe?</p>
javascript jquery
[3, 5]
2,333,372
2,333,373
How do I "find" in Jquery?
<pre><code>$("#start").find(divs where class=desc).show() &lt;div id="start"&gt; &lt;div class="desc" style="display:none;"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>How do I do that?</p>
javascript jquery
[3, 5]
3,336,957
3,336,958
javascript regex pattern with a variable string not working
<p>I am trying to create a function that will pass some parameters to a regex script:</p> <pre><code>function classAttributes( classString, className ) { var data; var regex = new RegExp(className+"\[(.*?)\]"); var matches = classString.match(regex); if ( matches ) { //matches[1] refers to options inside [] "required, email, ..." var spec = matches[1].split(/,\s*/); if ( spec.length &gt; 0 ) { data = spec; } } return data; } </code></pre> <p>but for some reason it doesnt like the string variable that I pass it "new RegExp(className+"[(.*?)]");" it doesnt throw an error but the validation doesnt work.</p> <p>Edit: I will take the information from the class stribute and pass it as classString</p> <pre><code>&lt;div class="field-character-count test[asd, 123, hello]"&gt;&lt;/div&gt; </code></pre> <p>and the "className" will represent "test"</p>
javascript jquery
[3, 5]
4,354,936
4,354,937
How to Create Session in asp .net C# login and registration memberprofile page
<p>I am new to ASP .net C# i created registration,login and member profile page</p> <p>after all validations data is stored in database.. and login page also working fine...</p> <p>i dont know about sessions ..how can i create session and how to make login module more effective using sessions?</p> <p>thanks in advance </p>
c# asp.net
[0, 9]
5,015,522
5,015,523
Why jQuery.CSS do not working?
<p>I have jScript.js file and style.css file. </p> <p>This is code of jScript file:</p> <pre><code>var height = window.innerHeight; var width = window.innerWidth; var start_point = (width - 790)/2; $("#logo").css({ 'left' : start_point }); </code></pre> <p>This is code of CSS file:</p> <pre><code>#logo { background-color:#3F0; border:1px dotted #CCCCCC; width:250px; height:270px; position:fixed; z-index:3; } </code></pre> <p>And HTML file:</p> <pre><code>&lt;div id="#logo"&gt;&lt;/div&gt; </code></pre> <p>But my jQuery CSS file is do not work! I can't get my position left:start_point;</p> <p><a href="http://jsfiddle.net/uUcvJ/" rel="nofollow">http://jsfiddle.net/uUcvJ/</a></p> <p>Why it's do not working??? Help me please</p>
javascript jquery
[3, 5]
872,066
872,067
reverse an onclick function
<p>So this is pretty basic stuff but I'm awful with javascript.</p> <p>I'm working on the following page: <a href="http://mockingbirdagency.com/thebox/bettercss/login-1.html" rel="nofollow">http://mockingbirdagency.com/thebox/bettercss/login-1.html</a></p> <p>with the following function.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function() { $('#button-sign-up').click(function() { $(this).css("margin-top","10px"); $('#details').toggle(500); $('#container-bloc-center').css("height", "290px") }); }); &lt;/script&gt; </code></pre> <p>When I click on the button again,I'd like it to go back to its original position, how can I do that ?!</p>
javascript jquery
[3, 5]
3,271,546
3,271,547
Developing using a non-official kit on the Android?
<p>I have been doing some research on developing on the Android platform and found that the only way to develop an app using C++ is using the NDK. I also came to know that the NDK has limited support to C/C++, with C++ having even lesser support than C. Here's the problem. I need to develop using C++ as I'm not very familiar with Java. In fact, not familiar at all. I'm still 18, so I don't have much experience with many programming languages. After doing some more research I have found a non-official NDK, called the NDK-CrystaX that implements more support for C/C++ than the official NDK. Before I start using I have to know if it would be legal to use this custom NDK in an Android app and still be able to sell it on the Android Marketplace. Is it? Or is it not? Another solution would be if the newer releases of the NDK had full support for C/C++. But I'm not sure of that either, so I'm seeking your generosity again and asking you to share your knowledge on this too.</p>
c++ android
[6, 4]
5,610,089
5,610,090
Close fullscreen flash from JS/Jquery
<p>I have a lightview window that needs to appear when an item in a fullscreen flash movie is clicked. SO i want to put into the lightview callback a bit of JS that will close the fullscreen flash movie. Is it possible to close a fullscreen flash movie in JS?</p>
javascript jquery
[3, 5]
3,690,272
3,690,273
Facebox adding commas to input
<p>I'm using a facebox to display a form inside a lightbox, nothing too exciting (just a couple of datepickers, some textboxes and a checkbox). However, I'm having issues with the postbacks, whenever I post back from the facebox it adds a ',' to the start of the input (so "rabbit" becomes ",rabbit") Now, I saw that there was the same issue with the modalpopup extender from the ajaxcontroltoolkit, so I assume it's a common issue.</p> <p>Can anyone <strike>either explain <em>why</em> this is happening, or tell me how to fix it?</strike> provide a decent way of fixing this? I have actually done it, and it works very nicely, but I don't really want to answer my own bounty question so someone else give it a go!</p> <p>Cheers, Ed</p> <p><em>EDIT</em></p> <p>See attached answer for a correct solution (I fixed this eventually but didn't want to ruin the bounty question so left the answer until afterwards).</p>
asp.net javascript jquery
[9, 3, 5]
5,797,123
5,797,124
Is it possible to reveal the contents of a div from right to left
<p>I created a fiddle</p> <p><a href="http://jsfiddle.net/gifcy/bJJ5s/5/" rel="nofollow">http://jsfiddle.net/gifcy/bJJ5s/5/</a></p> <p>On DOM ready I hide the image. </p> <p>I could successfully reveal the image from left to right using animate function.</p> <p>Can someone show how to reveal from right to left. What additional parameters need to used. </p>
javascript jquery
[3, 5]
5,638,013
5,638,014
Open New tab in browser
<p>I want to open new tab in all browser. I had written the following code:</p> <pre><code>&lt;asp:LinkButton ID="TotalRegular_LinkButton" runat="server" Font-Underline="false" OnClientClick="window.open('AllMember.aspx?Index=1','new window','width=950,height=500,scrollbars=no,status=no,toolbar=no,resizable=no,location=no,menubar=no,directories=no');"&gt; &lt;%# Eval("TotalRegular")%&gt; &lt;/asp:LinkButton&gt; </code></pre> <p>It opens the tab in Mozilla Firefox (Win XP) but not in Windows 7. And in case of Internet Explorer, it doesn't open new tab at all. </p> <p>Any Suggestion guys where am I going wrong?</p>
javascript asp.net
[3, 9]
3,385,321
3,385,322
How to draw a curve on 2 points (Android, Java)
<p>I have a two points, but I don't know start and end angles, and I need draw a curve on this points. Help me please. Thank you for helping, anyway. </p>
java android
[1, 4]
1,141,217
1,141,218
What's more important: To write programs fast or to write fast programs?
<p>What's more important: To write programs fast or to write fast programs? According to: <a href="http://math.stackexchange.com/questions/17478/how-quickly-with-better-tool">http://math.stackexchange.com/questions/17478/how-quickly-with-better-tool</a> it is better to write fast programs, but I wanted to ask this Q here to get the general gist of what you're thinking on this subject. Of course I'm taking as a given that all programs have to be correct etc. etc.</p>
java c# c++
[1, 0, 6]
46,176
46,177
Learning C# after C++
<p>In a progression of languages, I have been learning C and C++. Now I would like to learn C#. I know there are some drastic differences between them - such as the removal of pointers and garbage collection. However, I don't know many of the differences between the two.</p> <p>What are the major differences that a C++ programmer would need to know when moving to C#? (For example, what can I use instead of STL, syntactic differences between them, or anything else that might be considered important.)</p>
c# c++
[0, 6]
4,720,544
4,720,545
Pass variable into selector in foreach loop
<p>I have a set of ids being generated in a foreach loop</p> <pre><code>&lt;?php foreach ($_Collection as $_item): ?&gt; &lt;img class="&lt;?php echo $_product-&gt;getId() ?&gt;" src="&lt;?php echo Mage::helper('catalog/image')-&gt;init($_product, 'small_image')-&gt;resize(100, 75); ?&gt;" /&gt; </code></pre> <p>I want to be able to grab specific divs with ajax by using the class that is generated as it will match both in this and the target document. So I was hoping to try something like this in the same foreach loop :</p> <pre><code>$(document).ready(function() { var item = "&lt;?php echo $_product-&gt;getId() ?&gt;"; $('img .'+item).click(function (){ $('#result').load('ajax-page .'+item+') }) </code></pre> <p>This is just for an example but I am sure there are multiple things wrong. For one what is printed looks like ... </p> <pre><code>var item = "156294"; $j('img .'+item).click(function (){ $j('#result').load('ajax-page .item') }); </code></pre> <p>For starters... how can I pass the <em>item</em> variable to the selector from within this loop?</p>
php javascript jquery
[2, 3, 5]
5,590,683
5,590,684
prevent page jump on .html and .append?
<p>when i use jquery .html or .append to add elements in the DOM the page jumps to that location.</p> <p>how can i make it not jumping, cause i want my users to be able to click on "save thread to favourites" and it wont jump to "my saved threads" cause then the user has to navigate down in the list with threads again.</p> <p>EDIT: i have used this:</p> <pre><code> // save thread $("a.save_thread").live("click", function(event) { event.preventDefault(); $.post('controllers/ajaxcalls/threads.php', {method: 'save_thread', thread_id: event.target.id}, function(data) { }, 'json'); return false; }); </code></pre> <p>but the return false didnt do anything. and actually, although it doesnt use append() or html() it still jumps to page start.</p>
javascript jquery
[3, 5]
5,828,380
5,828,381
How can I know whether the scroll of the user is UP or DOWN?
<p>I want to determine the scroll of the users. I'm using jQuery.. And jquery have .scroll event.. But the .scroll event can't determine whether the user is scrolling the page downwards or upwards.</p>
javascript jquery
[3, 5]
1,426,662
1,426,663
property disabled and html
<p>This seems like a fairly simple thing, but the issue has been giving me some trouble for a long time now. I have a submit button that is 'disabled' when a select list value is 'select'. What I want is to html('select an area')...but the button is disabled. Here is the code:</p> <pre><code>&lt;script&gt; //setting the variable for first-shown select value var selVar = $('#areaSel').val(); //disabling submit if first-shown value is 'select' if(selVar == 'select'){ $('#areaSubmit').prop('disabled',true); } //setting the variable if the selection changed &amp; disabling submit if = 'select' $('#areaSel').change(function(){ var selVar = $('#areaSel').val(); if(selVar == 'select'){ $('#areaSubmit').prop('disabled',true); //removing 'disabled' submit if selection !== select }else{ $('#areaSubmit').prop('disabled',false); } }); //giving the message to 'select an area $('#areaSubmit').click(function(){ var selVar = $('#areaSel').val(); if(selVar == 'select'){ $('#areaE').html('select an area'); } }); &lt;/script&gt; </code></pre> <p>Im just trying to make the message 'select an area' appear instead of submitting when clicked. The problem is that the button is disabled when 'select' is selected. Thanks in advance for the help!</p>
javascript jquery
[3, 5]
3,197,379
3,197,380
Handling multilanguage with JQuery only
<p>I use JQuery in my web app and I am wondering what the best way to handle multilanguage in that context is.<br> I was thinking of creating a file like:</p> <pre><code>label["login"]["fr"]="Connection" label["login"]["en"]="Login" </code></pre> <p>Once the file is loaded I will then do (for each label) a:</p> <pre><code>$('#login').text(label["login"][selected_language]); </code></pre> <p>In HTML I would then use: </p> <pre><code>&lt;a href="login.html"&gt;&lt;span id="login"&gt;&lt;/span&gt;&lt;/a&gt; </code></pre> <p>Is this a correct way to do ?</p>
javascript jquery
[3, 5]
882,000
882,001
Android: Include External Jar in Build (Without Eclipse)
<p>I'm working with Android at the moment, trying to avoid using Eclipse (for which I have an irrational hatred).</p> <p>I need to include an external <code>.jar</code> file (used in my <code>Activity</code>)and have no idea how to link it for <code>ant debug</code>...</p> <p>I've read up on <code>build.xml</code> files but adding <code><code>&lt;</code>path id="compiler.classpath"<code>&gt;</code>...<code>&lt;</code>/...<code>&gt;</code></code> or <code><code>&lt;</code>classpath<code>&gt;</code></code> nodes to the XML doesn't help fix it.</p> <p>Hope someone can help me out!</p>
java android
[1, 4]
2,511,681
2,511,682
checkboxlist select only one item
<p>I am trying to select only one checkbox from the list. Here is the code I am trying but it doesn't seem to be working. I can use RadioButtonlist but it doesn't allow me to deselect the radio button. Please let me know.</p> <pre><code>$(document).ready(function () { var checkboxlistid = "#&lt;%= chkLst.ClientID %&gt;"; $(checkboxlistid + " input:checkbox").click(function () { $(this).attr("checked",""); }); </code></pre> <p>});</p> <pre><code> &lt;asp:CheckBoxList ID="chkLst" runat="server" RepeatDirection="Horizontal"&gt; &lt;asp:ListItem Value="U"&gt;Unknown&lt;/asp:ListItem&gt; &lt;asp:ListItem Value="R"&gt;Ref&lt;/asp:ListItem&gt; &lt;/asp:CheckBoxList&gt; </code></pre>
jquery asp.net
[5, 9]
1,046,060
1,046,061
Create Unique Image (GUID to Image)
<p>I'd like to do something like SO does with profile pictures of new users. It seems to create a unique image based on a value.</p> <p>How can I repeatedly create the same unique image from a GUID?</p> <p>I'm open to doing this on the server, but would prefer a client side solution to create it on the fly.</p> <p>Something like these:</p> <p><img src="http://i.stack.imgur.com/voTUF.png" alt="enter image description here"> <img src="http://i.stack.imgur.com/gGqBl.png" alt="enter image description here"> <img src="http://i.stack.imgur.com/BP4uS.png" alt="enter image description here"></p> <p><strong>Edit:</strong> How can I repeatedly create the same unique "nice looking" image from a GUID?</p>
c# jquery asp.net
[0, 5, 9]
671,173
671,174
Building in debug versus release build, performance implications?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3714213/implications-of-deploying-a-debug-build-of-an-application">Implications of deploying a Debug build of an application?</a> </p> </blockquote> <p>What are the implications of using debug build on production servers?</p> <p>Other than having the source code on the servers (easier to de-compile etc), what are the disadvantages of running a debug build?</p> <p>The assembly file sizes are larger, any implications on garbage collection, memory usage, memory leaks or anything?</p>
c# asp.net
[0, 9]
5,172,863
5,172,864
document.ready runs even if window.load is loaded
<p>What to write to check if window is fully loaded then do some functions and if not then do <code>document.ready</code> functions....i.e : i have a preload image which appears if windows isnt fully loaded and i call it in <code>docuemnt.ready</code>.....and if window is fully loaded i hide this preload image....it runs correctly if window isnt fully loaded and disappear after window get loaded.....but <code>document.ready</code> get called even if window is already loaded ...so how to check if window is loaded then dont do <code>document.ready</code> and if not then do <code>document.ready</code></p> <pre><code>$(document).ready(function (e) { $("#loding").css("visibility", "visible"); $("body").css('overflow', 'hidden'); $("#container").css("opacity", 0); }); $(window).load(function (e) { $("#loding").animate({ opacity: 0 }, 500, function () { $("#loding").css("width", "70%"); $("#loding").css("visibility", "hidden"); }); $("#container").css("opacity", 1); $("body").css('overflow', 'auto'); }); </code></pre>
javascript jquery
[3, 5]
3,495,009
3,495,010
Previous view/undo in javascript
<p>Is there a way to go back to the previous view (not url), or so to speak undo a click in javascript or jquery?</p> <p>history.go(-1) wouldn't work because the previous view is not literally a url on the address bar. I am using a jquery plugin that create a object (album viewer), and you can navigate between different photos there, the url on the address bar would not change. I set it so that on click of the photo, the page would change to another page. I want to bring back the user to the previous view, which is the specific photo on the plugin created object.</p>
javascript jquery
[3, 5]
5,006,105
5,006,106
jquery hover effect
<p>How can I get same effect like this </p> <p><a href="http://bavotasan.com/demos/fadehover/" rel="nofollow">http://bavotasan.com/demos/fadehover/</a></p> <p>But only for anchor tags not for images, let say I have anchor background blue and I want it to change to red but with this effect, how can I do that? thank you</p>
javascript jquery
[3, 5]
769,601
769,602
Syncing data in Android app
<p>I'm developing an app that syncs different data through JSON in almost every Activity. This data could be manipulated by other devices so I have to keep it updated whenever possible.</p> <p>For example, in the first Activity I login to the webservice, and in the next Activity I use AsyncTask to download a JSON that tells me all car models in the store, and use that info to create a ListView. Clicking on one row, I call another AsyncTask to download specific information (JSON) about that car, and get for example information about it's tires. In the next activity I'm calling another AsyncTask to get specific info about those tires. Most of the time, required info to be used in the next Activity is stored in SharedPreferences, because I have no idea how to have ArrayLists accessible in the entire app, and I don't know if it's going to utilize a lot of RAM. And if it is a good idea to share so many objects through the app.</p> <p>You can see that everytime my Activity is reloaded, the AsyncTask checks the connection and download new data to be displayed. The service doesn't support push so I guess I have the responsibility to check it every time, correct?</p> <p>Another thing to consider is that data downloaded can be changed and in that case, I have to upload the JSON, and refresh the views accordingly. In this aspect I have no idea how to save "changes" to be uploaded when the connection is down. Like, creating a queued list of unsynced tasks.</p> <p>The result is an app that is heavily dependent on the internet connectivity and feels slow every time an Activity is resumed.</p> <p>For most part I instantiate a new ArrayList of objects (Car, Tires, etc), but I'm confused how to properly sync data back in JSON if everything is now an object. Maybe using GJON?</p> <p>I really need some tips about how to manage apps like this.</p> <p>Thanks</p>
java android
[1, 4]
583,934
583,935
jquery - change a drop down menu to a list
<p>Is there a way to convert a drop down menu to be a list using jquery... so:</p> <pre><code>&lt;select&gt; &lt;option&gt;1&lt;/option&gt; &lt;option&gt;2&lt;/option&gt; &lt;option&gt;3&lt;/option&gt; &lt;/select&gt; </code></pre> <p>to</p> <pre><code>&lt;ul&gt; &lt;li&gt;1&lt;/li&gt; &lt;li&gt;2&lt;/li&gt; &lt;li&gt;3&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
2,047,164
2,047,165
how to add a hyper link in a gridview
<p>I have a gridview control and I would like the field Title to be a hyperlink and execute a stored procedure when clicked. Can anyone assist me in this?</p> <p>Does this code look right?</p> <pre><code>&lt;Columns&gt; &lt;asp:TemplateField&gt; &lt;ItemTemplate&gt; &lt;asp:HyperLink ID="hpTitle" runat="server" Text='&lt;%# Bind("Title") %&gt;' NavigateUrl='&lt;%# Bind("SelectBook") %&gt;'&gt;&lt;/asp:HyperLink&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; &lt;asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /&gt; &lt;asp:BoundField DataField="Publisher" HeaderText="Publisher" SortExpression="Publisher" /&gt; &lt;asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" /&gt; &lt;/Columns&gt; </code></pre>
c# asp.net
[0, 9]
4,247,879
4,247,880
Separate save actions jQuery and PHP
<p>I have a form for saving the attendance of students to the MySQL database.</p> <p>Students' data is read from the database and create the data entry form.</p> <p>The form is designed to store the code, name, presence status of each student and a short description in case of absence.</p> <p>I have designed the data entry form, but seem to need some clues regarding the save action so that clicking on each save button, the appropriate data is stored in the attendance table of the database.<img src="http://i.stack.imgur.com/ICQZk.jpg" alt="A screenshot of the form"></p>
php jquery
[2, 5]
3,791,973
3,791,974
Convert PHP Code To C#.Net
<p>I have a sample code on PHP.I need to be convert that PHP code to C#.Net 3.0.</p> <p>Please help me,If it is there any either converters or tools to perform this task.</p> <p>Thank you in advance....</p>
c# php
[0, 2]
132,476
132,477
Listen for event inside multiple functions
<p>I have a custom event which I listen to:</p> <pre><code>$(document).on('MyCustomEvent', function(e, data) { }); </code></pre> <p>My problem is that I would like to know when <code>MyCustomEvent</code> has fired inside a lot of different functions. I don't want to attach the event handler inside each function, since it doesn't make any sense and will probably override eachother.</p> <p>What I'm after is something like this:</p> <pre><code>function one(){ //"when MyCustomEvent is fired, do stuff with the 'data' here" } function two(){ //"when MyCustomEvent is fired, do stuff with the 'data' here" } </code></pre>
javascript jquery
[3, 5]
2,069,306
2,069,307
window.open not working when attached on onload event in chrome and safari
<p>I have attached some javascript on onload event of the form. this script contains window.open. Although this works fine in all the browsers window.open doesn't open a new window nor it gives nay error message in google chrome and firefox.</p> <p>I want to first check the screen resolution if it is less than 1024 then I would open it in a new window without menu,toolbar and others so that the user has more space to work on.</p>
asp.net javascript
[9, 3]
5,500,775
5,500,776
jquery having issue with global variable inside function ajax function
<p>Following is the code:</p> <pre><code>var ret; function fetch_data(param1){ $.post(param1, function(data){ if (data){ ret = data*2; console.log("data", ret); } else{ ret = 15; console.log("no data") } }); return ret; } function hello(){ ret = fetch_data("/post_data"); console.log("from the main function", ret); } </code></pre> <p>The above is a simplified schema of how i am working with things. i make a post request to a url and try to get the value, based on the returned value i manipulate the value and try returning it back to the function. The <code>console.log</code> shows a value inside the <code>fetch_data</code> function, but not within the <code>hello</code> function. Meaning no value is returned. Where am i getting it wrong?</p>
javascript jquery
[3, 5]
5,157,356
5,157,357
Including PHP variables in an external JS file?
<p>I have a few lines of jQuery in my web application. This code is inline at the moment because it accepts a couple of PHP variables.</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function(){ $('.post&lt;?php echo $post-&gt;id; ?&gt;').click(function() { $.ajax({ type: 'POST', url: 'http://domain.com/ajax/add_love', data: { post_id: &lt;?php echo $post-&gt;id; ?&gt;, user_id: &lt;?php echo $active_user-&gt;id; ?&gt;, &lt;?php echo $token; ?&gt;: '&lt;?php echo $hash; ?&gt;' }, dataType: 'json', success: function(response) { $('.post&lt;?php echo $post-&gt;id; ?&gt;').html(response.total_loves).toggleClass('loved'); } }); return false; }); }); &lt;/script&gt; </code></pre> <p>I'm a big fan of best practices though, so I would like to move my jQuery into an external JS file.</p> <p>How could I achieve such a feat?</p> <p>Any tips? I'm still relatively new to jQuery and PHP.</p> <p>Thanks!</p> <p>:)</p>
php javascript jquery
[2, 3, 5]
1,889,683
1,889,684
Mouseover/MouseOut jquery
<p>I realize how simple this question should be to answer but I am in a medication fog and the answer is escaping me. </p> <p>I would like to make this into a simple function to display specific text if the value of the text box is empty upon mouseout and to empty out the text value upon mouseover.</p> <p>What I have right now that works but is very ugly:</p> <pre><code>$(".disappearOnClick").live('mouseover',function() { if($(this).val() === 'BFA Offset') { $(this).val('') } }); $(".disappearOnClick").live('mouseout',function() { if($(this).val() === '') { $(this).val('BFA Offset') } }); </code></pre>
javascript jquery
[3, 5]
373,279
373,280
what is the easiest web scraping tool that handles javascripts
<p>I would like to make a web scraping application that is able to log in to a website (I was able to do this with twill (python)), and also to be able to execute JavaScript which trigger access to other pages.</p> <p>I would definitely prefer to use something in python, but I am ready to try something new. I have installed mechanize, watir, Hojocki, etc. but not sure if this really helps.</p>
javascript python
[3, 7]
4,815,613
4,815,614
How to do this box in Javascript?
<p>I'm trying to do the following sort of thing in Javascript, where you click on the down arrow and it expands downward and displays options (I'll have some input fields and checkboxes and text and stuff in there).</p> <p>Can anyone please help me out or point me in the right direction, I've tried google searching but I have no idea what they're even called in the Javascript world. "Javascript expanding box", "javascript drop down box", "javascript expanding modal dialog", etc. Nothing seems to hit. </p> <p>Here's the example:</p> <p><a href="http://imageshack.us/f/810/examplebe.jpg/" rel="nofollow">http://imageshack.us/f/810/examplebe.jpg/</a></p> <p>There will be a submit button in the top section (not in the expand section), which will submit the options in the drop down menu as well as the options in the section near the submit button.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
2,673,994
2,673,995
Activity methods : protected OnDestroy public OnBackPressed
<p>I have just a curiosity. If i override backpressed , ondestroy I notice that :</p> <pre><code> @Override public void onBackPressed() @Override protected void onDestroy() </code></pre> <p>Why onbackpressed is public and ondestroy is protected . I now difference between protected and public but i don t understand why they have different modifier . It is juts a curiosity </p>
java android
[1, 4]
5,940,144
5,940,145
Calling function within .each()
<p>I would like to repeat the chained events starting at <code>.animate()</code> from inside itself (indicated by comment). What is the correct way to write this?</p> <pre><code>$("div").each(function(i, e){ $(this).animate({ left: $(this).parent().width() }, d[i], "linear", function(){ $(this).css({left: -parseInt($(this).css("width")) }) //would like to call function at this stage }); }) </code></pre> <p><strong>This ended up working:</strong></p> <pre><code> $("div").each( v = function(i, e){ $(this).animate({ left: $(this).parent().width() }, d[i], "linear", function(){ $(this).css({left: -parseInt($(this).css("width")) }) v(); }); }); </code></pre>
javascript jquery
[3, 5]
61,333
61,334
Setting Class-Level Variable to Use Between Event Handlers
<p>I'm having a hard time understanding why the following code doesn't work. I'm sure it's something remedial that I'm missing or not understanding. I currently have a page that asks for user input. If, based on the input and logged in user, I find data from this page already in the database, I need to update the existing records rather than creating new ones, so I set a class-level bool to true. The problem is, when MyNextButton is clicked, PreviouslySubmitted is still false. So, I'm not sure how to make the value of this variable persist. Any advice is appreciated, thanks.</p> <pre><code>public partial class MyForm : System.Web.UI.Page { private bool PreviouslySubmitted; protected void Page_Load(object sender, EventArgs e) { MyButton.Click += (o, i) =&gt; { q = from a in db.TableA where (a.SomeField == SomeValue) select a; if(q.Any()) { PreviouslySubmitted = true; //populate the form's fields with values from database for user to revise } } MyNextButton.Click += (o, i) =&gt; { //the value of PreviouslySubmitted is false at this point, //even if I made sure it was set to true the previous postback if(PreviouslySubmitted) { //update database } else { //insert into database } } </code></pre>
c# asp.net
[0, 9]
3,388,072
3,388,073
How to selectively enable a Dropdown List
<p>I have a form containing two DropDowns lists:</p> <ol> <li>Marital Status</li> <li>No. of Children</li> </ol> <p>Now I would like to enable the No. of Children DropDown upon selection of following items in the Marital Status DropDown:</p> <ol> <li>Widow</li> <li>Divorced</li> <li>Awaiting Divorce</li> </ol> <p>How can I do it?</p>
c# asp.net
[0, 9]
1,858,506
1,858,507
jQuery checkbox multi select
<p>I have the following code for selecting multiple checkboxes:</p> <pre><code>$(document).ready(function() { /* All groups functionality */ $(".allGroups").change(function() { var checked = this.checked; if (checked == true) { $(".group").attr("checked", true); $(".c").attr("checked", true); } if (checked == false) { $(".group").attr("checked", false); $(".c").attr("checked", false); } }) /* Individual Group functionality */ $(".group").change(function() { var checked = this.checked; var number = this.value var set = '.group-' + number; $(set).attr("checked", checked); }) } ) </code></pre> <p>I gave 'contacts' the class <code>c</code> and <code>group-#</code>. Groups get the class <code>group</code>. The select all checkbox gets <code>.allGroups</code></p> <p>Now how do I achieve that the 'select all' checkbox unchecks itself when not everything is checked anymore?</p> <p>Got a jsFiddle up here: <a href="http://jsfiddle.net/nqHtu/1/" rel="nofollow">http://jsfiddle.net/nqHtu/1/</a></p>
javascript jquery
[3, 5]
904,929
904,930
Gridview not updating after removing row from linkbutton within an updatePanel
<p>I have a linkbutton in a gridview that when clicked will update the DB and should remove it from being visible in the gridview. This is also in an updatepanel. When clicking the linkbutton the DB is updated, however the gridview is never refreshed. Both gridview and linkbuttons are dynamically generated.</p> <p>Linkbuttons are created as follows: 'b' contains the unique id of the data in the row.</p> <pre><code>if (e.Row.RowType == DataControlRowType.DataRow) { LinkButton lbRemove = new LinkButton(); lbRemove.ID = "removeLink" + b; lbRemove.Command += new CommandEventHandler(lbRemove_Click); lbRemove.Attributes.Add("onclick","return confirm('Are you sure?');"); ....... e.Row.Cells[6].Controls.Add((Control)lbRemove); </code></pre> <p>lbRemove_Click contains the method to update DB and call the griview to bind amd update the panel:</p> <pre><code>protected void lbRemove_Click(object sender, CommandEventArgs e) { removeFromUser(Convert.ToInt32(e.CommandArgument.ToString())); loadGridviews(Convert.ToInt32(ViewState["currUserID"])); upnlUserDevices.Update(); </code></pre> <p>i have tried creating a linkbutton outside of the gridview using the exact same properties as the one in the gridview. When clicked it calls the same method and it refreshes the gridviews, just not when being clicked from within the gridview itself.</p> <p>Bit stuck on this one if you can help?? Thanks!</p>
c# asp.net
[0, 9]
3,654,128
3,654,129
javascript refreshing images every 5 seconds crashes web browser?
<p>I have a simple javascript code in an html page, refreshing an image every 5 seconds:</p> <pre><code>function refresh() { var unique = new Date(); document.images.EdwinImage.src = "http://192.168.0.125:8002/img?width=800&amp;height=480&amp;rnd=" + unique.getTime(); } </code></pre> <p>This code works fine on desktop browser, but on Android, it works only for some times then the browser closes without an error message and returns to the home screen. After the crash, I look in the browser settings (via Settings->Applications->Manage Applications) I noticed the browser application has a 55MB cache... which seems to be the problem... even though I don't need the image to be cached since I request a new one every time. Yes, I have the correct html header to disable caching.</p> <p>Here are the headers I'm using:</p> <pre><code>&lt;meta http-equiv="Cache-control" content="no-cache"&gt; &lt;meta http-equiv="PRAGMA" content="no-cache"&gt; &lt;meta http-equiv="expires" content="0"&gt; </code></pre> <p>I'm using Android 2.2 on a Archos HT7V2 and the problems happens on all browsers I tried (stock browser, opera mini, dolphin hd).</p> <p>How can I solve this problem? Or any ideas of what happened ? Thank you,</p>
javascript android
[3, 4]
2,300,275
2,300,276
jQuery: Get reference to click event and trigger it later?
<p>I want to wrap an existing click event in some extra code.</p> <p>Basically I have a multi part form in an accordion and I want to trigger validation on the accordion header click. The accordion code is used elsewhere and I don't want to change it.</p> <p>Here's what I've tried:</p> <pre><code> //Take the click events off the accordion elements and wrap them to trigger validation $('.accordion h1').each(function (index, value) { var currentAccordion = $(value); //Get reference to original click var originalClick = currentAccordion.click; //unbind original click currentAccordion.unbind('click'); //bind new event currentAccordion.click(function () { //Trigger validation if ($('#aspnetForm').valid()) { current = parseInt($(this).next().find('.calculate-step').attr('data-step')); //Call original click. originalClick(); } }); }); </code></pre> <p>jQuery throws an error because it's trying to do <code>this.trigger</code> inside the <code>originalClick</code> function and I don't think <code>this</code> is what jQuery expects it to be.</p> <p><strong>EDIT: Updated code. This works but it is a bit ugly!</strong></p> <pre><code> //Take the click events off the accordion elements and wrap them to trigger validation $('.accordion h1').each(function (index, value) { var currentAccordion = $(value); var originalClick = currentAccordion.data("events")['click'][0].handler; currentAccordion.unbind('click'); currentAccordion.click(function (e) { if ($('#aspnetForm').valid()) { current = parseInt($(this).next().find('.calculate-step').attr('data-step')); $.proxy(originalClick, currentAccordion)(e); } }); }); </code></pre>
javascript jquery
[3, 5]
3,648,585
3,648,586
Which is faster RegisterStartupScript or RegisterClientScriptBlock?
<p>I saw Difference between <code>RegisterStartupScript</code> and <code>RegisterClientScriptBlock</code> from <a href="http://stackoverflow.com/questions/666519/difference-between-registerstartupscript-and-registerclientscriptblock">here</a>.<br> There is describing the injection javascript code from Sever side using both of them.<br> Now I am also injecting client side script from an ASP.NET Server Control but my client script is just pointing to an external JavaScript file.</p> <pre><code>string jsString="&lt;script src="myscripts.js"&gt;&lt;/script&gt;" ClientScript.RegisterClientScriptBlock(this.GetType(), "JSScriptBlock",jsString); </code></pre> <p>I am using <code>RegisterClientScriptBlock</code>,but I want to know should I use <code>RegisterStartupScript</code> to be faster. Which is faster <code>RegisterStartupScript</code> or <code>RegisterClientScriptBlock</code> in my case?<br>Thanks.</p>
c# javascript asp.net
[0, 3, 9]
1,288,465
1,288,466
DataSet sorting
<p>In <code>DataTable</code> I could sorting with </p> <pre><code> dataTable.DefaultView.Sort = "SortField DESC"; </code></pre> <p>I'm getting a <code>DataSet</code> from database, I was wondering could I do a sorting on the <code>DataSet</code> like how I do it in <code>DataTable</code>.</p>
c# asp.net
[0, 9]
4,616,125
4,616,126
php function to echo javascript string
<p>Is the a proper php function to echo javascript string?<br> I want to the php function to echo something like this:</p> <pre><code>&lt;!--/* OpenX Interstitial or Floating DHTML Tag v2.8.7 */--&gt; &lt;script type="text/javascript"&gt;// &lt;![CDATA[ //&lt;![CDATA[ var ox_u = 'extremely_long_url_string'; if (document.context) ox_u += '&amp;context=' + escape(document.context); document.write("&lt;scr"+"ipt type='text/javascript' src='" + ox_u + "'&gt;&lt;/scr"+"ipt&gt;"); // // ]]&gt;&lt;/script&gt; </code></pre> <p>I know I can put it all in one line and use \ to escape all the quotes BUT I'm looking for a more elegant &amp; effective solution.</p>
php javascript
[2, 3]
1,142,079
1,142,080
Given a ISO 8601 weeknumber, how would you get the dates within that week
<p>I got a weeknumber from a jquery datepicker, when a user selects a date. But now I want to get all the days within that week.</p> <p>I could add a click event that loops through all the td's of the tr the selected date is in and graps it's value but I'm looking for a more reliable way.</p> <p>So my question is, given a certain date and a weeknumber (iso 8601 formatted), how can you derive the other dates within that week with javascript?</p>
javascript jquery
[3, 5]
144,213
144,214
Javascript / jQuery design question re: performance
<p>Is there any performance / memory hit differential among the three following styles?</p> <p>Exhibit A:</p> <pre><code>var func = function() { // do some magic } $("#div").somePlugin({someEvent: func}); </code></pre> <p>Exhibit B:</p> <pre><code>$("#div").somePlugin({someEvent: function() { // do some magic }); </code></pre> <p>Exhibit C:</p> <pre><code>function func() { // do some magic } $("#div").somePlugin({someEvent: func}); </code></pre>
javascript jquery
[3, 5]
5,663,946
5,663,947
Expanding on the jQuery post function
<p>I have the following function in my code:</p> <pre><code> $.post($form.attr('action'), $form.serializeArray()) .done(function (json) { } </code></pre> <p>From what I understand from the jQuery docs this is a shortcut. What I would like to do is to change so that it allows me to have some function that executes on success and some function that executes on error. Is this possible to do? All I see is a .done?</p> <pre><code>$.ajax({ url: target, dataType: 'json', type: 'POST', data: data, success: function(data, textStatus, XMLHttpRequest) { }, error: function(XMLHttpRequest, textStatus, errorThrown) { } </code></pre>
javascript jquery
[3, 5]
3,380,293
3,380,294
How to save file in ASP.NET MVC from Chrome?
<p>i am trying to save a file from chrome using AjaxSubmit. i got the problem that Chrome send the file in octet format and i am unable to check that if it is really image or anything else.</p> <p>when i try to call </p> <pre><code>HttpPostedFileBase file file.InputStream </code></pre> <p>inputstream caused error in chrome that <code>Parameter is not valid.</code></p> <p>how i can save them in asp.net c#</p>
c# asp.net
[0, 9]
2,274,147
2,274,148
jQuery effect - What is the name?
<p>There use to be a jQuery effect that when you initlized it.. the DIV/CLASS would slide up and fade away at the same time. I know it's not puff... but it was something. I remember becuase I found out about it after doing slide/fade when I was like.. oh I could have done this instead.</p> <p>But I can't find it on jQuery UI website anymore... help?</p> <p>I tried searching Google and especially jQuery API: <a href="http://api.jquery.com" rel="nofollow">http://api.jquery.com</a></p>
javascript jquery
[3, 5]
5,324,565
5,324,566
Php with Jquery
<p>I'm trying to pass the database values which is in table in a phtml to jquery popup on clicking on it.Below is my code.</p> <pre><code>foreach($this-&gt;paginator as $record) { $color="#E8E8E8"; echo "&lt;td width='61'&gt;&lt;a href='#'id='Popup'&gt;". $record['firstname'] . "&lt;/td&gt;"; echo "&lt;td width='61'&gt;" . $record['emailid'] . "&lt;/td&gt;"; echo "&lt;td width='38'&gt;" . $record['customdata'] . "&lt;/td&gt;"; echo "&lt;td width='72'&gt;" . $record['locationrating'] . "&lt;/td&gt;"; echo "&lt;td width='52'&gt;" . $record['cleanlinessrating'] . "&lt;/td&gt;"; echo "&lt;td width='58'&gt;" . $record['valueformoneyrating'] . "&lt;/td&gt;"; echo "&lt;td width='59'&gt;" . $record['kitchenequipmentrating'] . "&lt;/td&gt;"; } </code></pre> <p>How should i pass a value using href to jquery ?And also how should i fetch that in pop up window n use that to fetch details from phpcontroller.Please help me on this.</p>
php jquery
[2, 5]
4,217,029
4,217,030
Get value with javascript from a tag inside a tag
<p>I need to extract data from such code:</p> <pre><code>&lt;div class="rateCalc_InfoLine2"&gt; &lt;span style="font-size:12px;"&gt; Text1 - &lt;b&gt;&lt;font color="red" size="2"&gt;$ 500&lt;/font&gt;&lt;/b&gt;; Text2 - &lt;b&gt;&lt;font color="red"&gt;$ 30&lt;/font&gt;&lt;/b&gt; &lt;/span&gt; &lt;/div&gt; </code></pre> <p>So basically, I need to find the value <code>30</code> that is inside the <code>2nd font tag</code> of the <code>span tag</code> that is inside <code>div tag</code> with the class <code>rateCalc_InfoLine2</code>. The structure is static, so I dont need to worry about mistakes ( only the value <code>30</code> will change )</p> <p>I know hoe to get the value of the div like this: </p> <pre><code>$(".rateCalc_InfoLine2").html(); </code></pre> <p>but how to get the specific one I need?</p> <hr> <p>Answer: <code>$(".rateCalc_InfoLine2 font").eq(1).html().replace('$ ', '');</code></p>
javascript jquery
[3, 5]
3,231,524
3,231,525
jQuery star rating causing page scrolling
<p>I'm having a problem after adding button on my star rating. Every time when I click on the star, my page getting jumpy and scroll to the top. How can I prevent this behavior? </p> <p>My code:</p> <pre><code>$(document).ready(function(){ var rate=null; $(".one-star, .two-stars, .three-stars, .four-stars, .five-stars").click(function() { rate = $(this).html(); $("#submit_rating").fadeIn("slow"); $("#current_rating").width(rate*30); }); $('#submit_rating').click(function(){ $.ajax({data: ({ action: 'save_rating', rating: rate, listing_id: &lt;?php echo $id; ?&gt;}), success: function() { window.location.href = '&lt;?php echo $this-&gt;escape(URL); ?&gt;'; }}); return false; }); }); </code></pre> <p>you can see my problem here: <a href="http://duniakita.org/starrating/" rel="nofollow">http://duniakita.org/starrating/</a></p>
javascript jquery
[3, 5]
2,199,501
2,199,502
Grid view validations
<p>in my web application i have grid view control with edit property true. Now i want to use the validation when user not enter anything in text boxes, i not use the edit template i use boundfields. how can i use validation help me thank you. this is my code</p> <p> </p> <pre><code> &lt;Columns&gt; &lt;asp:TemplateField HeaderText="Topic Id"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="lblsid" runat="server" Text='&lt;%#Eval("subjectid") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;HeaderStyle CssClass="text2" /&gt; &lt;/asp:TemplateField&gt; &lt;asp:BoundField HeaderStyle-CssClass="text2" HeaderText="SubjectName" DataField="subjectname" /&gt; &lt;/Columns&gt; &lt;/asp:GridView&gt;&lt;/td&gt;&lt;/tr&gt; </code></pre>
c# asp.net
[0, 9]
1,866,352
1,866,353
Sending pictures from android device to server
<p>im trying to send a picture from a android device to a server and was wondering if it was possible to send the picture information in a xml file and rebuild it on the server? </p>
java android
[1, 4]
2,503,162
2,503,163
Fitting gridview within contentpalceholder
<p>I have a gridview which is bigger than the size of my contentpalceholder. It wont fit within the contentpalceholder and whenever I try to edit the gridview, it increases in width making it extend even further. Can someone help</p>
c# asp.net
[0, 9]
2,879,716
2,879,717
cloning only a specific item in a list using .clone() in Jquery
<p>I am trying to add only select items of a list to a new list. So for example, I only wish to add banana to my second list, the following code in my function adds all the items in coll-selected-list to coll-grouped-list. How may I only make a clone of a specific item. Any tips would be great.</p> <p>jQuery:</p> <pre><code>$("#coll-selected-list li").clone().appendTo("#coll-grouped-list"); </code></pre> <p>Markup:</p> <pre><code>&lt;ul id="coll-selected-list" class="droptrue sort-drop ui-sortable"&gt; &lt;li class="sorted"&gt;apple&lt;/li&gt; &lt;li class="sorted"&gt;pear&lt;/li&gt; &lt;li class="sorted"&gt;banana&lt;/li&gt; &lt;li class="sorted"&gt;grape&lt;/li&gt; &lt;li class="sorted"&gt;guava&lt;/li&gt; &lt;/ul&gt; &lt;ul id="coll-grouped-list"&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
3,600,536
3,600,537
How does the javascript behind Google Images work?
<p>Recently, Google Images <a href="https://plus.google.com/+google/posts/eQHPcukkr8S" rel="nofollow">redesigned</a> their site so a large lightbox opens up when you click an image. You can press arrow keys to advance the photo. Does anyone know how it works?</p> <p>I assume they have divs between the rows, but how do they determine where a row ends or where the next div to expand is? Do they recalculate everything using an onResize event?</p> <p>I'm pretty new to jQuery so this might be obvious.</p> <p>EDIT: I should note that for my project all the images are the same size, so I don't need a dynamic layout plugin.</p>
javascript jquery
[3, 5]
4,796,582
4,796,583
how to get the three previous dates for the given date .net
<p>I would like to get the 3 dates from the current date or if user enters a date like <code>16/07/2011</code> i would like to show the 3 previous dates for this like</p> <p><code>15/07/2011,14/07/2011,13/07/2011</code></p>
c# asp.net
[0, 9]
5,988,498
5,988,499
how to communicate with sqlserver using jquery
<p>I know we cannot communicate with sqlserver using jquery "directly" but I want to know about the indirect method I am working on a project with the following scenario</p> <ol> <li><p>a jquery script which is installed in the browser and when it is installed and the user opens a web page and hovers the mouse pointer over an image the script runs to check whether the image has an alternate text or not.If not it will tell the user there is no alternate text and a dialog box will open(which is a div in the html)</p></li> <li><p>the dialog box has<br> *textbox<br> *cancel button<br> *submit button</p></li> <li><p>now, in the submit button's code I would like the code to send that text into my database. I heard somewhere that we can transmit that text (from the textbox as entered by the user) using ajax to an aspx page on my website</p></li> </ol> <p>But i dont know how here is some code for convenience to understand the scenario also there is no Id for the buttons,only classes :( </p> <pre><code>Cancel: function(){ $( this ).dialog( "close" ); } $( "#dialog-form" ).dialog({ autoOpen: false, height: 300, width: 350, modal: true, buttons: { "Send your proposal": function() { var ID=this.id; //alert(ID); }); </code></pre>
javascript jquery
[3, 5]
5,814,982
5,814,983
Get div from page
<p>I've looked everywhere for a technique, but I failed to find much that suited my needs.</p> <p>Basically, I would like to utilize JavaScript or jQuery (probably using Ajax) to grab a div that contains a word from a page on my site. </p> <p>I'm not asking anyone to code this for me, I would just like to be pointed in the right direction.</p> <p>For example, let's say I have this HTML page:</p> <pre><code>&lt;div class='findfromthis'&gt;hello guys&lt;/div&gt; &lt;div class='findfromthis'&gt;goodbye guys&lt;/div&gt; &lt;div class='findfromthis'&gt;goodbye people&lt;/div&gt; </code></pre> <p>I would like to display all the <code>divs</code> that contain the word "guys" in them.</p> <p>Thank you so much in advance!!</p>
javascript jquery
[3, 5]
4,060,590
4,060,591
How do I strip the first character
<p>I am constructing a URL and I have</p> <pre><code>escape($('#count_of_stations').html() </code></pre> <p>The problem is the value will come in like this </p> <pre><code>1 station 2 stations </code></pre> <p>I need to strip everything other then the first character, so is there a way to sent it with the " station(s)"?</p>
javascript jquery
[3, 5]
5,859,033
5,859,034
PHP Webserver in Python
<p>How can I make a PHP 5.3 webserver using Pythin? I know how to make a simple http server, but how can I include PHP?</p> <p>Thanks.</p>
php python
[2, 7]
520,255
520,256
JavaScript or jQuery, how to find element
<p>I have the following HTML:</p> <pre><code>&lt;div data-name="countrySelectorRoot"&gt; &lt;select&gt; &lt;option value="C1"&gt;Country 1&lt;/option&gt; &lt;option value="C2"&gt;Country 2&lt;/option&gt; &lt;option value="C3"&gt;Country 3&lt;/option&gt; &lt;option value="C4"&gt;Country 4&lt;/option&gt; &lt;option value="C5"&gt;Country 5&lt;/option&gt; &lt;/select&gt; &lt;script type="text/javascript"&gt; // Some script which finds parent div... &lt;/script&gt; &lt;/div&gt; </code></pre> <p>Inside script, I need code which needs to find my "countrySelectorRoot" div <code>(var MyRoot = // Code that finds element with data-name="countrySelectorRoot").</code></p> <p>However, I can have multiple divs with same data-name attribute and same contents, but I need to find the the specific one which is the parent of the script.</p> <p>How to do this?</p>
javascript jquery
[3, 5]
5,618,096
5,618,097
gridview's javascript return wrong value
<p>on my popup page i have a gridview, when client clicks a row it sends the datakey to the parent page </p> <p>with this javascript;</p> <pre><code>&lt;script type="text/javascript"&gt; function Done(val) { window.returnValue = val; window.close(); } &lt;/script&gt; </code></pre> <p>i put a break point on javascript code , when i click the row , i see that gridview sends the true value such as Done(02002) , i see that on my griview </p> <p>but when i look at the script val = 1026 how this could be happening there is even no value such as 1026 on my page thats how i add the javascript to my gridview</p> <pre><code>protected void grdSearch_RowDataBound(object sender, GridViewRowEventArgs e) { if ((e.Row.RowType == DataControlRowType.DataRow)) { //string dd = e.Row.Cells[0].Text; // ((Button)e.Row.FindControl("btnSec")).Attributes.Add("onclick", "Done(" &gt;+ e.Row.Cells[0].Text + ")"); e.Row.Attributes.Add("onclick", "Done(" + e.Row.Cells[0].Text + ")"); e.Row.Attributes.Add("onmouseover", &gt;"this.style.backgroundColor='#3f529c';this.style.color='#FFFFFF';this.style.cursor='pointe&gt;r';"); e.Row.Attributes.Add("onmouseout", &gt;"this.style.backgroundColor='#FFFFFF';this.style.color='#3f529c'; "); string dd = e.Row.Cells[0].Text; } } </code></pre>
javascript asp.net
[3, 9]
44,929
44,930
Scrolling bottom div with jquery
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3742346/use-jquery-to-scroll-to-the-bottom-of-a-div-with-lots-of-text">Use jQuery to scroll to the bottom of a div with lots of text</a> </p> </blockquote> <p>I have a div where load a number of comments from a database. The div has a height expressed in em not px. It also has enabled the overflow.</p> <p>When I write a comment and send it recharges I want the scroll to move to the end of the div. Using <code>$("# boxcoment"). ScrollTop (400)</code> within the succes and working properly I automatically moves the scroll.</p> <p>But I work with em and want to know if <code>.scrollTop()</code> works with em or if there is another way to scroll down to the end of the div.</p> <p>I tried also with:</p> <pre><code>height = $("#boxcoment").height(); $("#boxcoment").scrollTop(height); </code></pre> <p>But the scroll just stops halfway.</p> <p>Thanks</p>
javascript jquery
[3, 5]
616,699
616,700
Image.FromFile with a username password. C#
<p>Ok we need to load a file on the network, (Files are stored seperatly from the webserver).</p> <p>Is there anyways we can specify a network userid a password when calling the function below?</p> <p>Image.FromFile("\IPADDRESSHERE\GroupPictures\");</p>
c# asp.net
[0, 9]
4,444,010
4,444,011
Passing event args from javascript to code-behind while using ClientScript.GetPostBackEventReference
<p>I'm trying to trigger a postback from <em>java-script</em> and also pass event args. I'm able to trigger the postback **but not able to pass event args.</p> <p>The below funtion does not work. It does not like the <code>args</code> parameter in <code>ClientScript.GetPostBackEventReference</code>.</p> <pre><code>&lt;script type="text/javascript"&gt; function TriggerServerSideClick(args) { //btnDummy is a asp.net server-side button control &lt;%=ClientScript.GetPostBackEventReference(btnDummy, args , true)%&gt; //tried this -&gt; &lt;%= 'ClientScript.GetPostBackEventReference // (btnDummy,' + args + ', true)' %&gt; , // but i guess i am definitely missing something. } &lt;/script&gt; </code></pre> <p>What am I missing here ? </p> <p>I know that the following works </p> <pre><code> __doPostBack('btnDummy', args); </code></pre> <p>but want to stay away from <code>__doPostBack</code> as that could change eventually and try the <code>ClientScript.GetPostBackEventReference</code> instead.</p> <p>Thanks for your time.</p> <p>@Brian: Thanks a lot for following up. I tried your placeholder approach but I am getting a javascript error. (<strong>Message: Expected ';'</strong>)<br> Here is the viewsource snippet: </p> <pre><code>var postbackUrl = '__doPostBack('ctl00$MainContent$btnDummy','{0}')'; function TriggerServerSideClick(args) { var url = String.format(postbackUrl, args); eval(url); } </code></pre>
javascript asp.net
[3, 9]
1,031,802
1,031,803
How to pre-select a value in RadioButtonList inside a GridView
<p>This might be a silly question but how can I preselect a <code>RadioButtonList</code> value based on existing data?</p> <p>I have this code inside the aspx file:</p> <pre><code>&lt;asp:TemplateField ItemStyle-CssClass="ItemCommand" &gt; &lt;HeaderTemplate&gt;&lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;asp:RadioButtonList runat="server" ID="rbLevel" RepeatLayout="Flow" RepeatDirection="Horizontal" &gt; &lt;asp:ListItem Text="Read" Value="0"&gt;&lt;/asp:ListItem&gt; &lt;asp:ListItem Text="Edit" Value="1"&gt;&lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>But I can't set the value of the list. <code>RadioButtonList</code> doesn't have a <code>SelectedValue</code> property, setting <code>DataValueField</code> has no effect and I can't set the values one by one (using something like: <code>Selected='&lt;%# ((Rights)Container.DataItem).Level == 1 %&gt;'</code>) because databinding happens on the list not specific items.</p>
c# asp.net
[0, 9]
3,236,271
3,236,272
jQuery How to affect Single element on mouseOver
<p>As I'm still learning, this question might seem to be very simple to answer, but I still need to ask.</p> <p>How do I need to change this script, so it will not display all the tooltips?</p> <p>What is happening now is whenever I hover on <code>.pink-nose a</code> all the <code>.tooltip</code> are fading in at this same time </p> <pre><code> $(function(){ var pn = $('.pink-nose a') var tp = $('.pink-nose .tooltip') tp.css({'display':'none'}) pn.mouseover(function(){ tp.fadeIn() }) }) </code></pre> <p>Thank you for your help in advance</p>
javascript jquery
[3, 5]
3,648,132
3,648,133
jQuery replace div based on rel attribute
<p>I'm trying to replace a div based on a class name and a rel attribute. </p> <pre><code> &lt;script type="text/javascript"&gt; $(function () { $('.special_button').click(function () { var num = $(this).attr('rel'); $(button with class .value_button and rel=num).replaceWith("&lt;div class='value_button' &gt;" + $(this).val() + "&lt;/div&gt;"); $('div.content_slide').slideUp(600); }); }); &lt;/script&gt; </code></pre> <p>How would you do this?</p>
javascript jquery
[3, 5]
907,878
907,879
JQuery .attr problem. $('#id').attr('value'); returns Undefined
<p>I had this working, and somewhere along the lines I messed something up. Since then I've made several changes trying to get the problem fixed, and now I'm just stuck. As of now I have this:</p> <pre><code> var calBtn = $('#calButton').attr('value'); function disappearingTable() { if (calBtn = 'Turn Calendar Off') { $('.calendarLayer').toggle(); $('#calButton').attr('value', 'Turn Calendar On'); } else if (calBtn = 'Turn Calendar On') { $('.calendarLayer').toggle(); $('#calButton').attr('value', 'Turn Calendar Off'); } } </code></pre> <p>That's in script tags in the header. Then in the body I have this.</p> <pre><code>&lt;form id="calendarForm" action="javascript:void(0);"&gt; &lt;input type="submit" id="calButton" value="Turn Calendar Off" onclick="disappearingTable()" /&gt; &lt;/form&gt; </code></pre> <p>I can't figure it out for the life of me. Even when I tried regular Javascript, I still get undefined. Anyone help? Thanks!</p>
javascript jquery
[3, 5]
3,128,210
3,128,211
android downloader, how can i customize
<p>I can use <code>android downloader</code> to download files. and the code is <strong><a href="http://stackoverflow.com/a/10950971/1140321">Here</a></strong></p> <p>By default android stores the files in <code>download</code> directory.How can I specify the path where it should be downloaded? If this is not possible ,I plan to copy the file in sdcard and I want to delete the src file(the file in <code>download</code> folder.But I am unable to delete the file from <code>download</code> folder.How can I achieve it?</p>
java android
[1, 4]
4,449,851
4,449,852
On events in loop in dynamic elements
<p>I need to set events to elements makes "on the fly", like <code>var X = $('HTML CODE HERE')</code>, but when I set the events to the last element, all other elements get this last event.</p> <p>Example here: <a href="http://jsfiddle.net/QmxX4/6/" rel="nofollow">http://jsfiddle.net/QmxX4/6/</a></p> <pre><code>$(document).ready(function() { var ulItem = $('.lst'); for (var x=0; x&lt;5; x++) { var newItemElement = $('&lt;li style="border:solid 1px blue;width:200px;height:40px;"&gt;&lt;/li&gt;'); ulItem.append(newItemElement); var generator = Math.random(); newItemElement.on('click', function() { console.log(generator); }); } }); </code></pre> <p>All elements are diferents, and I attach the event in the element directly, im try to append before and after add event to element, but not work, all element get the last event.</p> <p>If you make click in the <code>&lt;li&gt;&lt;/li&gt;</code> get code generated in the last event, but "in theory" all elements have diferent events attached..</p> <p>But if I make other loop appending elements after append al items to <code>&lt;ul&gt;&lt;/ul&gt;</code>, like this:</p> <pre><code>$.each($(ulItem).children('li'), function(i, item) { console.log($(this)); var generator = Math.random(); $(this).on('click', function() { console.log(generator); }); }); </code></pre> <p>Works... what is the problem?</p>
javascript jquery
[3, 5]
3,272,097
3,272,098
call farbtastic color picker with javascript
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5443728/how-to-call-farbtastic-color-picker">How to call farbtastic (color picker).</a> </p> </blockquote> <h1>update</h1> <p>I want to call the farbtastic color picker, I already read the following tutorials, but I don't know how to get my own values with javascript. that's my html and color picker placeholder. <a href="http://acko.net/dev/farbtastic" rel="nofollow">enter link description here</a></p> <pre><code>enter code here &lt;form action="controller.php" method="post" class="popupform" id="form_changecolor"&gt; &lt;div id="colorpicker"&gt;&lt;/div&gt; &lt;table&gt; &lt;tr&gt;&lt;th&gt;huidige:&lt;/th&gt;&lt;th&gt;nieuwe:&lt;/th&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;&lt;input type="text" name="oldcolor" disabled="disabled" id="oldcolor" /&gt; &lt;/td&gt;&lt;td&gt;&lt;input type="text" name="newcolor" id="newcolor" /&gt;&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;div class="buttonrow"&gt; &lt;input type="hidden" name="page" value="{$PAGE}" /&gt; &lt;input type="hidden" name="module" value="changecolor" /&gt; &lt;input type="hidden" name="id" id="parameter_key" value="" /&gt; &lt;input type="submit" class="btnOk" value="Aanpassen" /&gt; &lt;input type="button" class="btnCancel" value="Annuleren" /&gt; &lt;/div&gt; </code></pre> <p></p>
php javascript jquery
[2, 3, 5]
4,698,216
4,698,217
Set each data id and assign it to href
<p>I am running the following code as I am trying to get each <code>.fotorama</code> id first and then assign each of them as each <code>.nav</code> link href. </p> <pre><code>$(".fotorama").each(function(){ id = $(".fotorama", this).data("id"); $(".nav li a").attr("href", '#'+ id); }); </code></pre> <p>This is giving me <code>#undefined</code> to each <code>.nav</code> link tho</p> <p>How should I do to set same href as each <code>.fotorama</code> id?</p> <p>html, just an example, ids and menu items are dynamically generated on the site*</p> <pre><code>&lt;ul class="nav"&gt; &lt;li&gt;&lt;a href=" "&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=" "&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href=" "&gt;&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class="fotorama" id="p1"&gt;&lt;/div&gt; &lt;div class="fotorama" id="p2"&gt;&lt;/div&gt; &lt;div class="fotorama" id="p2"&gt;&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
3,126,373
3,126,374
can not access usercontrol properties inside main page
<p>I have a user control</p> <pre><code>public partial class ConLib_Custom_ClickAndCollect : System.Web.UI.UserControl { public string Address { get { if (ccTextBox.Text != String.Empty) return ccTextBox.Text.ToString(); else return "United Kingdom"; } } private Address _clickCollectAddress; public Address ClickCollectAddress { get { return _clickCollectAddress; } set { _clickCollectAddress = value; } } } </code></pre> <p>and when i try to use this control in another .ascx page like this.</p> <pre><code>&lt;uc:ClickAndCollect ID="ClickAndCollectPanel" runat="server" Visible="false" EnableViewState="true" /&gt; </code></pre> <p>and in code behind i can see only Address Property and not ClickCollectAddress property.</p> <pre><code>ClickAndCollectPanel.Address // and can not see this ClickAndCollectPanel.ClickCollectAddress </code></pre> <p>i dont know what is the issue.</p> <p>please help. thanks</p>
c# asp.net
[0, 9]
4,749,917
4,749,918
jQuery .hover on Android - Prevent clickthrough
<p>The following code works fine to display a dropdown on the desktop, and on iOS, but on Android, it creates a click event and refreshes the page. How can i stop that? I've not found anything simple to solve this? </p> <p>jQuery:</p> <pre><code>$('nav li').hover( function () { $('ul', this).fadeIn(100); }, function () { $('ul', this).fadeOut(100); } ); </code></pre> <p>HTML:</p> <pre><code>&lt;nav&gt; &lt;ul&gt; &lt;li&gt;&lt;a href=""&gt;Products&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/nav&gt; </code></pre>
android jquery
[4, 5]