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,262,991
1,262,992
How might I block an IP address using JavaScript or jQuery?
<p>I use the <a href="http://www.computersolutions.Spruz.com" rel="nofollow">www.Spruz.com</a> network for my website. I am not looking to use PHP or SSL blocking methods being that I can't as is. I can't seem to find JavaScript or jQuery code to possibly hide a DIV element or redirect without having to use PHP or SSL methods. I am getting hit with foreign spammers/advertisers that are hitting up my messengers and whatnot. I need to block a few IPs but I am lost. How might I achieve my goal?</p>
javascript jquery
[3, 5]
1,810,962
1,810,963
Display an image in a <div>, jQuery
<p>The value of ig is being transfered fine, but I need to put this image into an image, please tell me what I am doing wrong.</p> <pre><code>var ig = '&lt;img src='+$(this).attr('src')+' style="z-index:1"&gt;'; $('#big').val(this) </code></pre> <p>Thanks Jean</p>
php jquery
[2, 5]
4,368,768
4,368,769
C++ or Java for android?
<p>I am thinking about picking up android development in my free time. I see that development is possible in Java and C++ but the latter is limited. </p> <p>I am much more comfortable with C++.</p> <p>So my question is what limitations exist with C++ on Android? Will I be able to develop full apps with it, or will I eventually have to learn Java?</p>
java c++ android
[1, 6, 4]
1,710,338
1,710,339
replacing div content with a click using jquery
<p>I see this question asked a lot in the related questions, but my need seems very simple compared to those examples, and sadly I'm just still too new at js to know what to remove...so at the risk of being THAT GUY, I'm going to ask my question...</p> <p>I'm trying to switch out the div contents in a box depending on the button pushed. Right now I have it working using the animatedcollapse.toggle function, but it doesn't look very good. I want to replace it with a basic fade in on click and fade in new content on next button. </p> <p>Basic idea:</p> <pre><code>&lt;div&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="this will fade in the first_div"&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="this will fade in the second_div"&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="this will fade in the third_div"&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div class="first_container"&gt; &lt;ul&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="second_container"&gt; &lt;ul&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;div class="third_container"&gt; &lt;ul&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;li&gt;stuff&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I've got everything working with the animated collapse, but it's just an ugly effect for this situation, so I want to change it out.</p> <p>Thanks! Joel</p>
javascript jquery
[3, 5]
192,923
192,924
Keypress event for Japanese text
<pre><code>$(document).ready(function () { $("#id").keydown(function () { }); }) </code></pre> <p>This code perfectly works for everything(number,alphabet,symbol etc) except Japanese text. On key press it doesn't pass through this event. Does anybody know any solution?</p>
javascript jquery
[3, 5]
2,159,276
2,159,277
Force page to reload from server instead of load the cached version
<p>I have webpage A. The user clicks on a form to submit data, and it takes him to webpage B. When he clicks the back button, I need webpage A to be refreshed from the server, rather that loaded from cache. I have this: <code>&lt;meta http-equiv="expires" content="0"&gt;</code> but it doesnt seem to work. I have also tried setting a variable on page B (session variable via php) and then check for it on page A and refresh (or not) according to its existence. This doest seem to work either. The basic code for that is: Page A:</p> <pre><code>&lt;?php if(isset($_SESSION['reloadPage'])) { unset($_SESSION['reloadPage']); echo' &lt;script&gt; window.location.replace("/****/****/*****.php"); &lt;/script&gt; '; } ?&gt; </code></pre> <p>And on page B:</p> <pre><code>$_SESSION['reloadPage'] = 1; </code></pre> <p>With the PHP solution, it simply keeps trying to refresh the page in a never ending loop. Something in my logic missing? Is this the right way to go about it?</p> <p><strong>EDIT</strong> Upon further investigation, when you tell the browser to not cache the page, does that force a full <em>server side</em> refresh as well? That's what I need. A full server side refresh of the page.</p>
php javascript jquery
[2, 3, 5]
1,735,096
1,735,097
check/uncheck tick checkboxes but ignore any disabled ones
<p>I'm using the following Jquery to check/uncheck checkboxes but some of the boxes in are disabled so I don't need to be checked. </p> <p>Is there a way I can tell the script to ignore disabled checkboxes?</p> <pre><code>$('.uncheck').click(function () { if ($(this).is(':checked')) { $('.customers input:checkbox').removeAttr('checked'); } else { $('.customers input:checkbox').attr('checked', 'checked'); } }); </code></pre>
javascript jquery
[3, 5]
3,366,695
3,366,696
Passing php variable to javascript
<p>I have a variable which stores the path of the file. I am using a pop up window to display that image. I am using following script</p> <pre><code>function newPopup(url) { popupWindow = window.open( url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=yes,scrollbars=no,toolbar=no,menubar=no,location=no,directories=no,status=yes') </code></pre> <p>Using it as</p> <pre><code>echo '&lt;td width="150"&gt;&lt;a href="JavaScript:newPopup(\'ajax-loader.gif\');"&gt;ScreenShot&lt;/a&gt;&lt;/td&gt;'; </code></pre> <p>When I give the name not stored in variable as mentioned above, the script works fine. But when I try to give the variable $end_file, it is not working. I have tried following combinations</p> <pre><code> echo '&lt;td width="150"&gt;&lt;a href="JavaScript:newPopup(\''.'$end_file'.'\');"&gt;ScreenShot&lt;/a&gt;&lt;/td&gt;'; echo '&lt;td width="150"&gt;&lt;a href="JavaScript:newPopup(\'{$end_file}\');"&gt;ScreenShot&lt;/a&gt;&lt;/td&gt;'; </code></pre> <p>But none seems to work</p>
php javascript
[2, 3]
1,291,555
1,291,556
JavaScript Security Concerns?
<p>I'm working on an eCommerce application that's using quite a bit of JavaScript and jQuery. Everything is checked server-side before anything is processed, but there has been a lot of news lately regarding web-based break-ins via JavaScript. I was just wondering what type of things I can do to reduce this threat and if there were any good websites that had information on this.</p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
454,092
454,093
Using Python to grab output from a C++ program (thru cout)
<p>I have the following code in Python</p> <pre><code>import subprocess import time info = subprocess.STARTUPINFO() info.dwFlags |= subprocess.STARTF_USESHOWWINDOW info.wShowWindow = subprocess.SW_HIDE t1 = time.clock() h = subprocess.Popen([r"C:\Users\MyName\Desktop\test.exe"], startupinfo=info) h.communicate() t2 = time.clock()-t1 print "Return Code:", h.returncode print "Duration:", t2 </code></pre> <p>This works great if I am looking for the program's return code but what if I want to grab things that the program simply cout's to the screen and manipulate them as variables in Python?</p>
c++ python
[6, 7]
712,202
712,203
What is Control's DesignMode property and how to use it?
<p><br> what is DesignMode property? When it is useful? I don't understand it from msdn definition <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.designmode.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.web.ui.control.designmode.aspx</a></p> <p>Some example? Thanks for answer.</p>
c# asp.net
[0, 9]
2,617,123
2,617,124
Generating one location while the phone is not moving
<p>I would like to know <strong>how can I generate one location using the gps or network providers while the phone is not moving more then something like 10 meters</strong> which means you at home, or in the same place.</p> <p>The minTime parameter doesn't really matters I guess (speaking about the requestLocationUpdates method of course), the minDistance is the one that should make the diffrence. I tried to set the value to 100m but I keep getting locations while my didn't moved(maybe 1 meter.. was tested while I were sleeping) so I kept raising the value and I stoped in 500 meters!! since it became useless.</p> <p>Maybe there is a way to check the distance between 2 locations?or receiving information about the phone movement?</p>
java android
[1, 4]
1,593,058
1,593,059
Can anyone explain the meaning and usage of POJO or POCO
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3326319/what-does-the-term-plain-old-java-objectpojo-exactly-mean">What does the term Plain Old Java Object(POJO) exactly mean?</a> </p> </blockquote> <p>I know those are recent concepts proposed by Mark Fowler. can anyone explain what the purpose of POJO or POCO and their usage?</p>
c# java
[0, 1]
471,737
471,738
PHP list() equivalent in Python
<p>Is there any equivalent to the PHP list() function in python? For example:</p> <p>PHP:</p> <pre><code>list($first, $second, $third) = $myIndexArray; echo "First: $first, Second: $second"; </code></pre>
php python
[2, 7]
1,792,213
1,792,214
Is there a plugin to validate jQuery code?
<p>Is there a jQuery plugin which can check our code before launch it ?</p> <p>Example:</p> <p>I write this :</p> <pre><code>jQuery('.myclass')css('color','red'); </code></pre> <p>The plugin will show me some message like 'parse error line ...' because I forgot a period</p> <p>Or:</p> <pre><code>function test() { alert('test'); ... tet(); </code></pre> <p>Message: The <code>tet()</code> function doesn't exist.</p> <p>EDIT: or maybe it could be some Firefox plugin ?</p>
javascript jquery
[3, 5]
5,879,547
5,879,548
How to detect if a JS variable is undefined?
<pre><code>// mystring contains dynamic text. Sometimes can be // null var a = mystring.split(" "); var proc = a[0] + " " + a[1]; </code></pre> <p>If <code>a</code> does not contain text, after <code>split</code> proc is undefined. If I try to assing its value to a textbox the result is "undefined":</p> <pre><code>mytextbox.val(proc); </code></pre> <p><img src="http://i.stack.imgur.com/CceHo.jpg" alt="enter image description here"></p> <p>So I need a way to make that proc has always a value, at least an empty string.</p>
javascript jquery
[3, 5]
3,764,690
3,764,691
How to toggle between list using buttons
<p>Hi when I click a option in the list a chart is generated then come back to the list and then click the second option to view the next one but i need to view the charts like images by giving next </p> <p>Thanks in advance</p> <p>Cheers</p> <p>DeanJones.M</p>
java android
[1, 4]
3,997,519
3,997,520
Clone is not working in Internet Explorer
<p>I am trying to use jQuery's <code>clone</code> method for a project, but it doesn't seem to be working in any IE version. Its working fine in Chrome though. But when ever it comes to IE, it just wont work. I am looking at some very similar issues but I cant figure out how to get around this.</p> <p>This is what I have:</p> <pre><code>$('.productHolder .product').eq(0).clone().appendTo('.holdOne'); </code></pre>
javascript jquery
[3, 5]
603,497
603,498
How to create setup for wep application in asp.net
<p>How will i create setup for web application. Please help me and tell me step by step</p> <p>thankx</p>
c# asp.net
[0, 9]
3,604,215
3,604,216
jQuery to check empty string
<pre><code>var id = "&lt;?php echo $val-&gt;id; ?&gt;"; var myRadio = $('input[name=&lt;?php echo "mala".$val-&gt;id; ?&gt;]').val(); if (myRadio.val.length &gt; 0){ $("#anketa").load('http://www.svastara.rs/anketa/anketa_m1_data', { answer: myRadio, id: id }); } }); </code></pre> <p>Why this <code>if (myRadio.val.length &gt; 0)</code> returns it looks like false, when i am sure that there is something in the string. If its not a good way, how to check that the string is empty or not?</p>
javascript jquery
[3, 5]
3,987,367
3,987,368
$(document).on('click', selector, function() ) combined with :not
<p>I've got several list items, when I click on the item I want the browser to redirect to ".title > a" link (href). But I don't want any event on the "notThis" selector.</p> <p>see the example <a href="http://jsfiddle.net/VTGwV/29/" rel="nofollow">http://jsfiddle.net/VTGwV/29/</a></p> <pre><code>&lt;div class="item"&gt; &lt;div class="title"&gt; &lt;a href="www.jsfiddle.net"&gt;jsfiddle.net&lt;/a&gt; &lt;/div&gt; &lt;div&gt; djføljdsaføljdsf a&lt;/div&gt; &lt;div&gt; djføljdsaføljdsf a&lt;/div&gt; &lt;div&gt; djføljdsaføljdsf a&lt;/div&gt; &lt;div class="notThis"&gt; &lt;a href="/test.html"&gt;link1 &lt;/a&gt; &lt;a href="/test2.html"&gt;link2&lt;/a&gt; &lt;/div&gt; </code></pre> <p>​</p> <p>script</p> <pre><code>​$(document).on('click', '.item', function(event) { window.location.href = $(event.currentTarget).find('.title &gt; a').attr('href'); });​ </code></pre> <p>I've tried :not('.notThis') without any luck. </p> <p><strong>Changes</strong> Thanks for all the answers, but I found another problem. If I have a event handler on the whole item , I can't manage to click on the link in "notThis" selector, because it returns only "false". Isn't there a way to use .not / :not combined with $(document).on('click', -------)</p>
javascript jquery
[3, 5]
3,957,053
3,957,054
how to darw the image faster in canvas
<p>I am capturing mobile snapshot(android) through monkeyrunner and with the help of some python script(i.e. for socket connection),i made it to display in an html page.but there is some time delay between the image i saw on my browser and that one on the android device.how can i synchronise these things so that the mobile screen snapshot should be visible at the sametime on the browser.</p>
javascript python
[3, 7]
3,408,336
3,408,337
ASP.NET: Creating versions of the same website
<p>My new assignment at work is to create a second version of our existing web application. Currently, our application supports only full time brokers, but now we our launching a second site specifically for part time brokers.</p> <p>The new site will be almost identical to our existing site with the following exceptions:</p> <ul> <li>It will have it's own branding.</li> <li>A couple of the user controls used for displaying information will be different (but none of the pages will be different).</li> <li>Our existing users should not have access to the new site and vice versa.</li> <li>It needs to be easy to test both versions of the website from within Visual Studio easily.</li> <li>We want to reuse as much our existing code as possible.</li> <li>I have 2 weeks to do this.</li> </ul> <p>I'm hoping that this is a common scenario and someone out there has some advice for how to accomplish this.</p>
c# asp.net
[0, 9]
2,089,430
2,089,431
setInterval jumps when move between browser tabs
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5927284/how-can-i-make-setinterval-also-work-when-a-tab-is-inactive-in-chrome">How can I make setInterval also work when a tab is inactive in Chrome?</a> </p> </blockquote> <p><a href="http://www.datingjapan.co" rel="nofollow">http://www.datingjapan.co</a></p> <p>I have setInterval changing images as follows:</p> <pre><code> var initialFadeIn = 1000; //initial fade-in time (in milliseconds) var itemInterval = 6000; //interval between items (in milliseconds) var fadeTime = 2500; //cross-fade time (in milliseconds) var infiniteLoop = setInterval(function(){ position1.eq(currentItem1).fadeOut(fadeTime); if(currentItem1 == numberOfItems1 -1) {currentItem1 = 0;}else{currentItem1++;} position1.eq(currentItem1).fadeIn(fadeTime); }, itemInterval); </code></pre> <p>I notice when I move between browser tabs in Chrome that when I come back to the site (after the interval has passed) the images quickly jump to the next. Is it possible to make this smoother? or make this occur in the background?</p> <p>any info on this would be great.</p> <p>thx</p>
javascript jquery
[3, 5]
2,764,747
2,764,748
Cancel Post Request after posting a form to an IFrame
<p>I want to know if it's possible to cancel a post after posting a form to an IFrame.</p> <pre><code>$form = jQuery("&lt;form target='iframetarget' method=post&gt;&lt;files...&gt;&lt;/form&gt;"); $form.submit(); </code></pre> <p>I need <code>$form.cancelPost();</code> or something like that to cancel that request.</p>
javascript jquery
[3, 5]
5,152,914
5,152,915
How to get the order of dynamically created DropDownLists
<p>I've created some drop down lists using JavaScript, ASP.NET. </p> <p>A user can add as many drop down lists as he wants by clicking a "+" button and removing them by clicking a "-" button.</p> <p>If it's hard to understand what I mean pls see " <a href="http://stackoverflow.com/questions/10101262/how-to-implement-a-list-of-dropboxes-in-c-sharp">How to implement a list of dropboxes in C#</a> ".</p> <p>And now I'd like to implement the code behind and want to define the order of the drop down lists, but I don't know which one is my first drop down list, etc.</p> <p>We assume that all <code>&lt;asp:DropDownList&gt;</code> contain the following for list elements: method1, method2, method3 and method4. If a user selects an element, a method in the codebehind is implemented. </p> <p>Example: dropboxlist1: select list item method2,<br> dropboxlist2: select list item method1,<br> dropboxlist3: select list item method3, </p> <pre><code>string txt= ""; if (dropboxlistID.Text == "method1"){ txt = method1Imp(); } else if (dropboxlistID.Text == "method2") { txt = method2Imp(); } else if (dropboxlistID.Text == "method3") { txt = method3Imp(); } else { } </code></pre> <p>But at this moment I don't have any idea which drop down lists came first and which method should be performed on my string first.</p>
c# javascript asp.net
[0, 3, 9]
607,122
607,123
jQuery Toggle Divs
<p>I'm having a little problem implementing some jQuery into a page I am doing.</p> <p>I've got about half way to making it do what I want, but I can't get my head around the last part. Though I've used snippets of jQuery for a while I'm pretty new when it comes to writing my own code.</p> <p>Basically I want 4 Divs which are hidden by default to be opened by clicking on the relevant link, but only one Div should be shown at any one time, so if Div1 has been opened, clicking the Div2 button closes Div1 and opens Div2.</p> <p>Also there is a 5th button, which opens Div1 is no Divs are open, or if any Div is open, to close that open Div.</p> <p>I've been looking at these pages for help, but nothing is exactly what I'm after:</p> <p><a href="http://css-tricks.com/forums/discussion/16451/.slidetoggle-one-div-a-time-problems-please-help/p1" rel="nofollow">http://css-tricks.com/forums/discussion/16451/.slidetoggle-one-div-a-time-problems-please-help/p1</a></p> <p>www.randomsnippets.com/2011/04/10/how-to-hide-show-or-toggle-your-div-with-jquery/</p> <p>webdesignerwall.com/tutorials/jquery-tutorials-for-designers</p> <p>At the moment I've made it so that the Divs appear on a button click, but that's all, I can't work out to make the toggle logic from these examples work on my code.</p> <p>I've set up a JSFiddle here: <a href="http://jsfiddle.net/vx6qu/2/" rel="nofollow">http://jsfiddle.net/vx6qu/2/</a></p> <p>Thanks in advance</p>
javascript jquery
[3, 5]
438,750
438,751
redirect to a different page
<p>I need some help here:</p> <p>I am writing code to redirect a user to a different page and execute some code, if the user closes the window while he is working on something:</p> <pre><code>&lt;script type="text/javascript"&gt; window.onbeforeunload = function() { location.assign('http://www.somesite.com'); return "go?"; } &lt;/script&gt; </code></pre> <p>Now the code works fine if the user presses cancel. But if he presses Ok, the windows closes without a redirect. </p> <p>I just need a working code that does one simple thing - redirect the user if the window is closed - can anyone suggest me the code for it</p> <p>I know that most of you will say that I should not be doing this and I know that this is not the best practice. But if any one of you has written a successful piece of code, please share it here.</p>
javascript jquery
[3, 5]
2,504,387
2,504,388
Where is file after create in android, where it is?
<p>I create a file in android emulator, after that I try it on phone but I don't have the same dir. Where can I find my file on PHONE?</p> <pre><code>public void costam (String text) { try { FileOutputStream fOut = context.openFileOutput("samplefile.txt", context.MODE_WORLD_READABLE); OutputStreamWriter osw = new OutputStreamWriter(fOut); osw.write(text); osw.flush(); osw.close(); }catch(Exception e){ } } </code></pre>
java android
[1, 4]
5,673,051
5,673,052
break point is not hitting while debugging
<blockquote> <p><strong>Possible exact duplicates:</strong></p> <p><a href="http://stackoverflow.com/questions/1517311/reason-for-vs-net-current-breakpoint-will-not-be-hit-warning">Reason for VS.NET ‘current breakpoint will not be hit’ warning?</a><br> <a href="http://stackoverflow.com/questions/1233188/why-does-visual-studio-sometimes-not-go-to-my-breakpoints">Why does Visual Studio sometimes not go to my breakpoints?</a><br> <a href="http://stackoverflow.com/questions/856643/why-would-the-debugger-not-be-stopping-at-a-breakpoint-in-my-asp-net-application">Why would the debugger not be stopping at a breakpoint in my ASP.NET application?</a></p> </blockquote> <p>while debugging,the modified source code the break point is not hitted for a particular aspx page and the following error is shown in the break point</p> <p>"the break point will not be currently hit.the source code is different from the original version"</p> <p>but for other page it is working fine.</p>
c# asp.net
[0, 9]
2,116,572
2,116,573
how to cache data repository in asp.net?
<p>I just wonder how to cache my data repository I mean there are some data repositories in my project they are so useful and I have to call their method several times so I need some tools or maybe patterns to cache them on the client to avoid get extra and duplicate queries.</p> <pre><code>&lt;asp:DropDownList ID="Dropdownlist1" runat="server" DataTextField="DataTextField" DataValueField="Key"&gt; &lt;/asp:DropDownList&gt; Dropdownlist1.DataSource = dbContext.EntityTest1; Dropdownlist1.DataBind(); </code></pre> <p>For each running the page or web application whenever I use this control it makes an executable linq query and caching data from sql server then transfer them to client but in fact it is unnecessary.</p> <p>I think there are two different caching server side between sql server and application to avoid extra fetching data. and second caching client side between my application and client.</p> <p>What is the best solution for caching ? and is there any sample project to explain both of them ?</p>
c# asp.net
[0, 9]
1,678,623
1,678,624
JQuery nested this references
<p>I have some JQuery Code as follows:</p> <pre><code>$("#sh-zone-button-cart-menu").live("click", function(event) { event.preventDefault(); $("#sh-zone-cart-menu").toggle(0, function(){ if($(this).is(":visible")){ $(this).siblings(".sh-zone-button-link-menu-content").hide(); $("#sh-zone-button-cart-menu").parent().removeClass("current"); //need to reference (this) for $("#sh-zone-button-cart-menu") here } }); $("#sh-zone-button-cart-menu").parent().toggleClass("current"); }); </code></pre> <p>I am trying to access the this reference for my initial click from within another sub-element i.e. I would like to get the this reference that would have been available just after the first curly brace of my live() method. However, I need access to it from within another sub-element i.e. inside my toggle() method.</p> <p>How can I do this?</p> <p>Thanks.</p>
javascript jquery
[3, 5]
2,809,756
2,809,757
When browser close.How to run sqlk query when browser close in php
<p>I have some query regarding browser close issue.</p> <p>I am using xcart.When user have logged in website and Any situation browser will be closed any so session will be destroyed..and also run the sql query for user status will be offline.</p> <p>Regards, Manish Patel</p>
php jquery
[2, 5]
1,881,732
1,881,733
Create an app where I can physically write things out with my finger
<p>I am trying to create an app where I can physically write things out with my finger and erase them? Something like a big sticky note that you can just write on?</p> <p>How Would do this, i am really new to programming so i would really appreciate your help.</p> <p>My question is similar to a question asked here, so i just edited it his question</p> <p><a href="http://androidforums.com/android-applications/104361-notepad-app-widget-actually-lets-you-write-notes.html" rel="nofollow">http://androidforums.com/android-applications/104361-notepad-app-widget-actually-lets-you-write-notes.html</a></p> <p>any code, books, would be much appreciated.</p>
java android
[1, 4]
5,966,925
5,966,926
php language converter based on world map countries
<p>php language converter based on world map countries</p> <p><strong>For Example:</strong></p> <p>when i click on France Country</p> <pre><code>All Website Content Will Convert Into French Language </code></pre> <p>when i click on USA Country</p> <pre><code>All Website Content Will Convert Into English Language And Many More Language But Depend On Countries In World Map </code></pre> <p>Please guide me or help how to do that jquery or javascript script or function in php </p>
php javascript jquery
[2, 3, 5]
2,649,467
2,649,468
select items in a checkbox list based on their text
<p>i have a check box list in my asp.net page ...i need to select the check box based on their text...am getting these string values form the database and storing it in a array.....the below code works fine for a single text ..What should i do in case of array..how should i pass the array values in the if loop</p> <pre><code> for (int i = 0; i &lt; chkbx.Items.Count; i++) { if (chkbx.Text == "Dress" ) { chkbx.Items[i].Selected = true; } } </code></pre>
c# asp.net
[0, 9]
445,688
445,689
Cannot clear textbox after keypress event
<p>I know this questions is all over the place, but this is driving me crazy!!!</p> <p>Here is my code:</p> <pre><code>$(document).ready(function () { $('#MainContent_LoginUser_Password').keypress(function (e) { noCapsLock($('#MainContent_LoginUser_Password'), e, "Please turn off Caps Lock"); }); }); function noCapsLock(o, e, str) { var s = String.fromCharCode(e.which); if (s.toUpperCase() === s &amp;&amp; s.toLowerCase() !== s &amp;&amp; !e.shiftKey) { alert(str); o.val(''); } } </code></pre> <p>I am trying to clear the value of the textbox with the given id. The code above clears the text, but when a new key is pressed, the value of that key is shown (uppercase letters). I have tried the change(), keyup(), keydown() functions but they still do not seem to clear the textbox of the last value entered.</p> <p>Any help will be appreciated. Thank you!</p>
javascript jquery
[3, 5]
3,630,609
3,630,610
Jetbrains PHPStorm 5.0.4 tells me I have a Duplicated jQuery Selector
<p>This is the piece of jQuery I wrote,</p> <pre><code>$('#editUser').click(function(){ if ($(".selectedTR")[0]){ if($('.form-actions').is(':visible')){ $('.form-actions').slideUp('slow',function(){ $('.form-actions &gt; h3').text("Edit"); }).css('display', 'none'); } $('.form-actions') .css('display', 'block') .slideDown('slow'); } else{ alert("Please select a user"); } }); </code></pre> <p>How can I remove the duplicated selectors?</p>
javascript jquery
[3, 5]
1,846,991
1,846,992
Page and control attributes not working when using masterpages
<p>I'm having a lot of problems with various ASP.NET control and page attributes e.g.</p> <p><code>maintainScrollPositionOnPostBack</code> will not work in any shape or form, in markup, code-behind o web-config:</p> <pre><code>Page.MaintainScrollPositionOnPostBack = true; &lt;pages maintainScrollPositionOnPostBack="true" /&gt; </code></pre> <p>I've scoured the web to find a way to limit the width of columns in a gridview; many suggestions the same, none have worked for me.</p> <p>I've had strange issues with client-side validation: When I apply client side validators to the text fields and drop down, the button click event is inhibited (for ALL buttons on page; not just for submit button but also for global navigation buttons inheriting from a MasterPage). Some fields have more than one validator (e.g. required field and reg ex).</p> <p>When I comment out ANY of the validators, all buttons' click events function as expected...</p> <p>I've constructed test pages and some of these functions work ok (<code>maintainScrollPositionOnPostBack</code>, validators) but when I apply to page inherited from masterpage, problems again.. Could the problem be with masterpage?</p> <p>Any ideas on any of these problems very welcome.</p>
c# asp.net
[0, 9]
3,739,313
3,739,314
Make top row of GridView non-scrollable
<p>I have a GridView of 9 rows of which the first one is sort of "header" row.</p> <p>As there are 8 more rows they flow beyond the end of screen and need to be scrolled down to. However this scrolling also causes the first row to go "off-screen".</p> <p>Was wondering if there is any way I can prevent the first row alone from being scrolled off?</p> <p>I dont want to make this a separate LinearLayout as it is part of a dynamic View (the GridView) that I create at runtime.</p> <p>TIA</p>
java android
[1, 4]
1,105,248
1,105,249
Toast Notification From FileObserver Class
<p>I have an issue similar to <a href="http://stackoverflow.com/questions/5963438/toast-from-fileobserver">Toast from FileObserver</a>. However, I do not understand how to properly implement the Handler.</p> <p>Currently, I have a <code>FileObserver</code>-class and I am passing it context and a handler (context comes from <code>getApplicationContext()</code> from the service I call the <code>FileObserver</code>-class from). The handler I pass in (handle) is defined and created in the service. In the <code>onEvent()</code> of the <code>FileObserver</code>-class, I have:</p> <pre><code>handle.post(new Runnable() { public void run() { CharSequence text = "Hello toast!"; int duration = Toast.LENGTH_SHORT; Toast toast = Toast.makeText(context, text, duration); toast.show(); } }); </code></pre> <p>But, I end up with a <code>java.lang.NullPointerException</code>.</p> <p>How do I properly make the toast notification show up when I send it from the <code>onEvent()</code> of the <code>FileObserver</code>-class?</p>
java android
[1, 4]
549,510
549,511
Simple JQuery click-and-show doesn't work
<p>I'm using this simple bit of JQuery to show/hide a div by clicking on the link, I've used the same code a few times before and it worked perfectly but now all of a sudden it refuses to work.</p> <p>JQuery is properly included and the page doesn't give a Javascript error (or any other error for that matter).</p> <p>JQuery:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $('#addnew').css('display', 'none'); $('#shownew').click(function() { $('#addnew').toggle(); return false; }); }); &lt;/script&gt; </code></pre> <p>HTML (link):</p> <pre><code>&lt;a href='#' id='shownew'&gt;Add News Item&lt;/a&gt; </code></pre> <p>HTML (div):</p> <pre><code>&lt;div id="addnew"&gt; &lt;form id="new_news" enctype="multipart/form-data" action="news.php" method="post"&gt; Title: &lt;br/&gt;&lt;input type="text" name="title" id="title" /&gt; &lt;p&gt;Image (optional, will be shown after first paragraph) &lt;br/&gt;&lt;input type="hidden" name="size" value="2000000"&gt;&lt;input type="file" name="photo"&gt; &lt;p&gt;Article body: &lt;br/&gt;&lt;textarea cols='40' rows='5' maxlength='5000' name='body' id='body'&gt;&lt;/textarea&gt; &lt;p&gt;&lt;input type="submit" name="submit" id="submit" value="Submit" /&gt; &lt;/form&gt; &lt;/div&gt; </code></pre> <p>What could I possibly be missing here? As you see from the JQuery, the div is hidden to begin with. When I remove the line that says <code>$('#addnew').css('display', 'none');</code> the div is displayed correctly, but the link still doesn't toggle it on and off.</p>
javascript jquery
[3, 5]
2,769,790
2,769,791
Localized Alert MSG in asp.net
<p>I have a Localization Resources table that has resourceType, cultureCode, resourceKey, resourceValue columns.</p> <pre><code>resourceType | cultureCode | resourceKey | resourceValue Alert | en-US | Hello | Hello Alert | es-ES | Hello | Hola </code></pre> <p>I need to create an alert msg that translates based on where the user is from (US or Spain). I was thinking </p> <pre><code>alert('&lt;asp:Localize runat="server" id="locText" meta:resourcekey="Alert"&gt;Hello&lt;/asp:Localize&gt;'); </code></pre> <p>Does this look right?</p>
javascript asp.net
[3, 9]
2,262,036
2,262,037
Calculate element height the way slideDown() does
<p>Have you noticed that by using jquery's slideDown(), even on elements with dynamic content, you always get the perfect height of the effected element. Which is, for me at least, impossible to do by simply animating the css height value. Mostly because there is no way for me to know how did the height of an element (with a display:none) changed, during a dynamic content (AJAX) update.</p> <p>And since i've been working on some custom controls, i do need that capability to calculate things the way slideDown() does.</p>
javascript jquery
[3, 5]
145,843
145,844
Good tutorials/books for Java for the programmer with python background
<p>Lately I have come to realize that I should know some of Java for programming ( I want to program in android). When I read all the tutorials and some free e-books, they either assume no programming experience or assume the reader to come from C/C++ background. Since I am used to python and MATLAB for a long time, the strong-typed C/C++ is clumsy for me to follow. Is there any tutorials/book some of you folks know that assumes reader to be a python programmer and guides him through Java showing the similarities and differences between the two languages?</p> <p>I referred to following books and websites:</p> <p><a href="http://math.hws.edu/javanotes/" rel="nofollow">Introduction to programming using Java by David J. Eck</a> , which is nice but assumes little/no programming experience and have to go through many pages to get the basic.</p> <blockquote> <p>Java for Beginners by Ricardo Flask</p> </blockquote> <p>This books moves to and fro without talking about user's background and other things.</p> <p>This being said, I would like the book to answer few things like this right away and take through programming in Java:</p> <p>-Why a function can be implemented without adding it to class in Java which can be done in python? -What are the scope of various variables, their definition and how are they different from python?</p> <p>These are few things python programmer will look in my opinion, when they try to see to Java.</p> <p>Please suggest any materials that will help learning Java for python programmers.</p>
java python
[1, 7]
1,108,704
1,108,705
Find unique attribute update children value with jQuery
<p>I would like to update the following:</p> <pre><code>&lt;a data-fb="4dfsdgdsgsdfgsdfgcf08" class="fb-like" href="#"&gt; &lt;span class="like-icon"&gt;Likes:&lt;/span&gt; 10&lt;/a&gt; </code></pre> <p>I wish to update the value '10' with a result returned from a web service, I have the result stored in a variable called fbNumber. The data-fb attribute is unique so I wish to search for this and update the value.</p>
javascript jquery
[3, 5]
1,809,719
1,809,720
php jquery count down timer script
<p>i have one count down timer using <a href="http://keith-wood.name/countdown.html" rel="nofollow">http://keith-wood.name/countdown.html</a></p> <pre><code>var austDay = new Date(); austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26); $('#defaultCountdown').countdown({until: austDay,format: 'HMS'}); </code></pre> <p>this works fine.</p> <p>but for one year, as i can see in code that </p> <blockquote> <p>austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);</p> </blockquote> <p>is generating last date.</p> <p>my last date is coming from PHP and i want to change the above line so that last date will be calculated from one of PHP variable.</p> <p>Thanks</p>
php jquery
[2, 5]
5,357,756
5,357,757
Invoke javascript function from string
<p>I have the following code in my javascript module, however this requires me to make the functions visible to the outside world.</p> <pre><code>var mymodule = function() { var self = null, init = function () { self = this; $('.actionButton').click(function () { var worklistId = $(this).data('worklistid'), action = $(this).data('action'); self[action] &amp;&amp; self[action](worklistId); //watchout methods marked as not used are used by this invocation }) }, send = function () { // some logic }, finish = function () { // some logic }, delete = function () { // some logic }; return { init: init, send: send, finish: finish, delete: delete }; }(); mymodule.init(); </code></pre> <p>So the only thing I want to return in my module is the init function. However when I do this I cant invoke the functions, because the object (self) only contains the init function visible on the outside. </p> <pre><code>return { init: init }; </code></pre> <p>Is there any solution to invoke my functions like this without making them visible to the outside world? Please no if else statements, because my workflow is bigger then the 3 actions in this example. I want to make my module as closed as possible because this reduces the dependencies.</p> <p><strong>Update</strong></p> <p>Here is a updated jsfiddle with one of the proposed solutions, however this is giving me another issue. <a href="http://jsfiddle.net/marcofranssen/bU2Ke/" rel="nofollow">http://jsfiddle.net/marcofranssen/bU2Ke/</a></p>
javascript jquery
[3, 5]
2,336,458
2,336,459
asp:RadioButtonList add RadioButton to new line
<p>The problem is as: I have horizontal asp:RadioButtonList, with 3 buttons witch i add programaticly C# code The thing is that the third button must be on second line. How can i do it besides creating a new asp:RadioButtonList? I have tried adding br and \r\n to caption but that dose not help me.</p> <pre><code>ListItem _item1 = new ListItem("1", "1"); ListItem _item2 = new ListItem("2", "2"); ListItem _item3 = new ListItem("3", "3"); rbl.Items.Add(_item1); rbl.Items.Add(_item2); rbl.Items.Add(_item3); </code></pre>
c# asp.net
[0, 9]
2,659,930
2,659,931
.aspx page - using document.getElementById in pageLoad()
<p>In writing a .net web application using AJax, should I <em>always</em> use global variables to store controls within the pageLoad() function?</p> <p><strong>Example -</strong></p> <pre><code> var x; var y; function pageLoad() { x = document.getElementById("&lt;%= cboX.ClientID %&gt;"); y = document.getElementById("&lt;%= tbxY.ClientID %&gt;"); } function doStuff1() { x.enabled = false; y.style.visibility = "visible"; } </code></pre> <p><strong>Or in some cases should I do this -</strong></p> <pre><code> function doStuff2() { document.getElementById("&lt;%= cboX.ClientID %&gt;").enabled = false; document.getElementById("&lt;%= tbxY.ClientID %&gt;").style.visibility = "visible"; } </code></pre>
javascript asp.net
[3, 9]
2,175,118
2,175,119
Passing a PHP variable to another page via jQuery
<p>EDIT: I can put the question in a shorter way that perhaps focuses more closely on the real problem:</p> <p>Is there a way to keep PHP Sockets alive over multiple pages? That is, can I store the connection (the socket object) in any way?</p> <p>I want to save a socket connection between two PHP pages where the other page is loaded via jQuery ajax. I tried it with sessions and so far got this on my main page:</p> <pre><code>$sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); $res = socket_connect($sock, $host, $port); session_start(); $_SESSION['sock'] = $sock; </code></pre> <p>I then load a page with jQuery:</p> <pre><code>$("#" + in_name + "_holder").load("set_setpoint.php", {name:in_name, value:in_value}); </code></pre> <p>And in set_setpoints.php:</p> <pre><code>session_start(); require_once("sock_funcs.php"); echo $_SESSION['sock']; </code></pre> <p>I only get '0', but what I should get is something like "Resource id #xxx". Maybe sessions is the wrong way?</p>
php jquery
[2, 5]
4,295,422
4,295,423
How do I select elements based on all their content in jQuery?
<p>I have a series of <code>&lt;div/&gt;</code>'s as follows:</p> <pre><code>&lt;div&gt;.co.uk&lt;/div&gt; &lt;div&gt;.com&lt;/div&gt; &lt;div&gt;.gb.com&lt;/div&gt; &lt;div&gt;.uk.com&lt;/div&gt; &lt;div&gt;.net&lt;/div&gt; </code></pre> <p>How do I select just the divs containing <code>.co.uk</code>, <code>.com</code>, <code>.net</code>.</p> <p>If I use:</p> <pre><code>$('div:contains(".co.uk"), div:contains(".com"), div:contains(".net")`) </code></pre> <p>This causes the <code>.gb.com</code> and <code>.uk.com</code> divs to be selected as well.</p>
javascript jquery
[3, 5]
3,217,192
3,217,193
Showing confirmation box not working
<p>I am having issues making this javascript box come up, I think i am doing it wrong but cant figure out what it is. Please excuse have not worked with the Page.ClientScript much before. Basically, I want to display this box and if they click OK it will continue processing my logic otherwise if they click cancel it will keep them on the same page</p> <p>This is what i have.</p> <pre><code>Page.ClientScript.RegisterStartupScript(this.GetType(), "ConfirmBox", "Confirm('The numbers selected are not in the directory, Do you wish to continue?');", true); </code></pre> <p>I would appreciate any help. Thank you</p>
c# asp.net
[0, 9]
1,614,496
1,614,497
Truncate a string with the remaining space
<p>I have a list where each li element contains two div inside one div "main" :</p> <ul> <li><p>div "main" has a fixed width (saying 200px),</p></li> <li><p>div "part1" has a variable width (that of text and image that contains)</p></li> </ul> <p>=> I wish text inside div "part2" had as width that of div "main" less div "part1" (the remaining space)</p> <p>EX:</p> <pre><code>... &lt;li&gt; &lt;div class="main"&gt; &lt;div class="part1"&gt;A&lt;/div&gt; &lt;div class="part2"&gt;BlaBlaBla&lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="main"&gt; &lt;div class="part1"&gt;ABC&lt;/div&gt; &lt;div class="part2"&gt;BlaBlaBla&lt;/div&gt; &lt;/div&gt; &lt;/li&gt; &lt;li&gt; &lt;div class="main"&gt; &lt;div class="part1"&gt;ABCDE&lt;/div&gt; &lt;div class="part2"&gt;BlaBlaBla&lt;/div&gt; &lt;/div&gt; &lt;/li&gt; ... </code></pre> <p>It should display:</p> <pre><code>A BlaBla... ABC BlaB... ABCDE Bl... </code></pre> <p>I tried but it doesn't work :</p> <pre><code>$(function(){ $(".part1").each(function(){ var $this = $(this); var $len = 0; var $len = $this.outerWidth(); var $lenParent =$this.parent().outerWidth(); var newText2 = $this.next('.part2').text().substring(0,$lenParent-$len); $this.next('.part2').innerHtml(newText2+"..."); }); }); </code></pre>
javascript jquery
[3, 5]
2,885,827
2,885,828
How to tell if a drop down has options to select?
<p>How to tell if a drop down has options to select?</p>
javascript jquery
[3, 5]
105,330
105,331
Java c++ Reference question
<p>In c++ we use &amp; to represent pass by reference. Since objects are always passed by reference you do not need to use this &amp;? Or does it not matter?</p> <p>How do java and c++ differ in pass by value and reference. Everything in java I thought is pass by reference but it is pass by value? Why is this? So is it primitives are pass by value while class objects are pass by reference?</p>
java c++
[1, 6]
1,920,496
1,920,497
if () not working
<p>This is my code: </p> <pre><code>Log.d("inf", loader); if (loader == "Klasse"){ Log.d("inf", "Klasse yes"); OPTS = new String[] { //Something }; } else { Log.d("inf", "Klasse no"); OPTS = new String[] { //Something }; } </code></pre> <p>In the first Line, the Output is exactly "Klasse" but the next output is everytime "Klasse no". The loader String is set as follows:</p> <pre><code>String loader = ""; Bundle exta = getIntent().getExtras(); if(exta !=null) { try { json = new JSONObject(exta.getString("json")); loader = exta.getString("order"); } catch (JSONException e) { e.printStackTrace(); } } </code></pre> <p>Do you guys have any Idea whats wrong?</p>
java android
[1, 4]
5,457,826
5,457,827
Get changes to multiselect listbox selected items
<p>I have a listbox databound if not postback and items selected from a database (if applicable). If i select new items in the listbox and postback, my foreach logic always sees only the original selection, not the changes. Been banging my head trolling google for the answer. Here's the code behind:</p> <pre><code> foreach (ListItem li in lsb.Items) { if (li.Selected) { try { [sql insert] } } } </code></pre> <p>EDIT: I should add the listbox is contained within and updatepanel</p>
c# asp.net
[0, 9]
642,105
642,106
Converting double to string
<p>I am not sure it is me or what but I am having a problem converting a double to string.</p> <p>here is my code:</p> <pre><code>double total = 44; String total2 = Double.toString(total); </code></pre> <p>Am i doing something wrong or am i missing a step here.</p> <p>I get error <code>NumberFormatException</code> when trying to convert this.</p> <pre><code>totalCost.setOnTouchListener(new OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { // TODO Auto-generated method stub try{ double priceG = Double.parseDouble(priceGal.getText().toString()); double valG = Double.parseDouble(volGal.toString()); double total = priceG * valG; String tot = new Double(total).toString(); totalCost.setText(tot); }catch(Exception e){ Log.e("text", e.toString()); } return false; } }); </code></pre> <p>I am trying to do this in an onTouchListener. Ill post more code, basically when the user touches the edittext box i want the information to calculate a fill the edittext box.</p>
java android
[1, 4]
5,152,279
5,152,280
Simple javascript issue
<p>It turns out this does exactly what I want it to do. But HTML does not replace the function call with a value, which is why I got confused. The correct value IS passed into the array though. I am leaving this question here in case others have the same issue.</p> <p>I have some javascript:</p> <pre><code>&lt;script type="text/javascript"&gt; var $SAT = $SAT || []; $SAT.push(['setContent','subtype','sub']); $SAT.push(['setUser', '1234']); &lt;/script&gt; </code></pre> <p>but I want to replace 'sub' with a function call to retrieve the value by other means, like so:</p> <pre><code>&lt;script type="text/javascript"&gt; function getValue() { return 'Some Value'; } var $SAT = $SAT || []; $SAT.push(['setContent','subtype',getValue()]); $SAT.push(['setUser', '1234']); &lt;/script&gt; </code></pre> <p>however the resulting code does not replace the getValue() function call with 'Some Value' as I would have expected. Does anybody know why, and what I need to do to fix this?</p> <p>Much appreciated!</p>
javascript jquery
[3, 5]
5,637,230
5,637,231
Force jQuery to not register $
<p>I know there exists a command like jQuery.noConflict. But for this it first registers $, then un-registers it afaik.</p> <p>I want to edit the jQuery 1.3.2 code to stop it from registering the $ in the first place. I know its not the best of ideas, but I need this in a particular project. Am just not sure how it can be done? I mean what part of jquery.js should I edit/remove? Also, how can I rename jQuery to say jQ from the start itself?</p> <p>Thank you for your time. Would like any pointers.</p> <p>I think I need to delete the following from the jQuery code (for 1.4.2):</p> <pre><code>// Expose jQuery to the global object window.jQuery = window.$ = jQuery; </code></pre>
javascript jquery
[3, 5]
5,144,358
5,144,359
how to re-calculate variables in javascript
<pre><code>function scrollContent(){ var div = $('#scrolling-content'), ul = $('ul.image'), // unordered list's left margin ulPadding = 0; //Get menu width var divWidth = div.width(); //Remove scrollbars div.css({overflow: 'hidden'}); //Find last image container var lastLi = ul.find('li:last-child'); //When user move mouse over menu div.mousemove(function(e){ //As images are loaded ul width increases, //so we recalculate it each time var ulWidth = lastLi[0].offsetLeft + lastLi.outerWidth() + ulPadding; var left = (e.pageX - div.offset().left) * (ulWidth-divWidth) / divWidth; div.scrollLeft(left); }); } </code></pre> <p>This is how I scroll my image list. The problem is that <code>#scrolling-content</code> element's size is dynamic. It changes on window resize. Here;</p> <pre><code>$(window).resize(function() { $("#scrolling-content").css("width",$(window).width() + "px"); $("#scrolling-content").css("height",($(window).height()-400) + "px"); }); </code></pre> <p>So it has to recalculate the left value when user changes windows size. How sould I change script to do that? Recalling <code>scrollContent()</code> function with <code>window.resize</code> function is a noob solution I guess. And it creates conflict for IE.</p>
javascript jquery
[3, 5]
5,711,029
5,711,030
Is it possible to limit the user to upload an image with fixed dimension?
<p>Is there any Jquery Plugin to perform the image dimension operation on an image before being uploaded using uplodify. i want the plugin to check the image dimension with the fixed define size and then only process for uploading. </p> <p>right now i am doing it with PHP function, instead of server side validation i want to adopt the client side validation.</p>
javascript jquery
[3, 5]
3,957,472
3,957,473
PHP syntax for setting a variable
<p>I have a JS script which im converting the code over to PHP but am stuck on what the correct syntax is to create the same as this piece of code in JS in my PHP script:</p> <pre><code>var sdata = { "13":{ "22":["618","22","1","1","0","0","0"], "21":["617","22","1","1","0","0","0"] }, "14":{ "22":["619","22","1","1","0","0","0"], "20":["622","22","1","1","0","0","0"] }, "15":{ "20":["623","22","1","1","0","0","0"] } }; </code></pre> <p>Any ideas?</p>
php javascript
[2, 3]
2,648,743
2,648,744
substring of php var inside javascript
<p>i am trying to use the substring method inside a Js code wich echoes some php variable but it does not work.</p> <pre><code>$('#tarif_public_total').val( &lt;?php echo $_tarif_public; ?&gt; * $('#tarif_public').val() ) u=$('#tarif_membre').val()* &lt;?php echo $_tarif_membre; ?&gt; + $('#tarif_public').val()* &lt;?php echo $_tarif_public; ?&gt; uu=u.substring(0,6) $('#total_total').val(uu) </code></pre> <p>what im doing wrong here?</p>
php jquery
[2, 5]
2,394,925
2,394,926
FTP server returned 500 error with ASP.NET C#
<p>I 'm developing FTP exe ASP.NET、C#2.0 .</p> <p>but I FTP server returned 500 error</p> <pre><code>FtpWebRequest myReq; FtpWebResponse myRes; myReq = (FtpWebRequest)WebRequest.Create("ftp://test/aaa.txt"); myReq.Credentials = new NetworkCredential("xxxx", "xxxx"); myReq.Method = WebRequestMethods.Ftp.DownloadFile; myRes = (FtpWebResponse)myReq.GetResponse(); // here error occured </code></pre> <p>What's wrong?</p>
c# asp.net
[0, 9]
5,483,983
5,483,984
using self.location and url page values in jquery
<p>I currently have the following:</p> <pre><code>$ul.append('&lt;li&gt;' + '&lt;a href="setlocale.aspx?returnURL=default.aspx&amp;localesetting=' + this.slice(0) + '"&gt;' + this.slice(3) + '&lt;/a&gt;'); </code></pre> <p>Lets say my URL ends with: <code>/c-577-camping.aspx</code></p> <p>How do I use this value in my jquery? it should change <code>default.aspx</code> to <code>c-577-camping.aspx</code> and if the website is <code>www.site.com/c-517-cookers.aspx</code> then it should append:</p> <p><code>http://www.site.com/c-517-cookers.aspx?setlocale.aspx?returnURL=c-517-cookers.aspx&amp;localesetting=fr-FR</code></p>
javascript jquery
[3, 5]
2,067,006
2,067,007
jQuery .on() Not Working After Different Content Loaded
<p>If you go to <a href="http://www.elemovements.com" rel="nofollow">http://www.elemovements.com</a> and try clicking "Read more..." on the first article, it will work, along with if you click the same link in the archive. This is all taken care of by this block of code... it's messy, yes, but I've been trying to figure various ways of doing it.</p> <pre class="lang-js prettyprint-override"><code>( function() { var $Body = $("#news .inner"); var $Title = $("#news .title"); var strNewsURL = "&lt;?=URL_NEWS?&gt;"; $(document).on("click", "a:contains(Read More...)", function(event) { var strOld = $Body.html(); var strURL = $(this).attr("href").replace("index.php", strNewsURL); //var strBackURL = strURL.match(/archive.php/) ? "archive.php?xnewsaction=getnews&amp;newsarch=" + getURLVars(strURL)['newsarch'] : strNewsURL; $Body.slideUp(100); $.get( strURL, objNHF, function(strData) { $Body.html(strData + '&lt;a class="back"&gt;&lt;?=TEXT_BACK?&gt;&lt;/a&gt;').slideDown(1000, "easeOutBounce"); $(document).on("click", "#news a.back", function(event) { $Body.slideUp(100, function() { $(this).html(strOld); } ).slideDown(1000, "easeOutBounce");; event.preventDefault(); } ); } ); track(strURL); event.preventDefault(); } ); } )(); </code></pre> <p>If you try loading another page (let's say, "Contact"), then click "Home" again, the event fires but does not load the content into the div. What am I doing wrong here? Very puzzling.</p>
javascript jquery
[3, 5]
3,935,878
3,935,879
Avoid Page refresh on button click?
<p>I have this .net page where I have a media player control and a button. The button functionality is to call a stored procedure. I need the page NOT to reload and stop the video when the user clicks the button.</p> <p>Is there a way to do this?</p> <p>Here is the code</p> <p>watching.aspx</p> <pre><code>&lt;div id="video" runat="server"&gt; &lt;div id="myElement"&gt; Loading... &lt;/div&gt; &lt;/div&gt; &lt;asp:Button ID="btnWatchlist" runat="server" Text="add to watchlist" onclick="btnWatchlist_Click" /&gt; </code></pre> <p>watching.aspx.cs</p> <pre><code>public partial class Watching : System.Web.UI.Page { private int movieId = 0; protected void Page_Load(object sender, EventArgs e) { movieId = Int32.Parse(Request.QueryString["id"]); Movie movie = MovieAccess.GetMovieDetails(movieId); startVideo(movie); } private void startVideo(Movie movie) { string moviePath= "data/videos/"+movie.srcPath; String script = "&lt;script type='text/javascript'&gt;jwplayer('myElement').setup({file: '" + moviePath + "',image: '43.jpg', \"width\": 800,\"height\": 450,});&lt;/script&gt;"; ScriptManager.RegisterStartupScript(Page, Page.GetType(), "video", script, false); } protected void btnWatchlist_Click(object sender, EventArgs e) { MovieAccess.AddWatchlistMovie(movieId, User.Identity.Name); } } </code></pre>
c# asp.net
[0, 9]
4,078,048
4,078,049
jquery select element with more then one id's
<p>I have to select an element, its id is assigned by mysql, it looks like this: <code>id="Monza ( Italien )5"</code> it works fine for other elements because there is only one name, but in this case it's the city name then the country name. I tried selecting like this <code>$('#Monza')</code> but it didn't work.</p>
javascript jquery
[3, 5]
2,536,295
2,536,296
Generating a C++ executable from a C# application
<p>I have a WCF service accepting requests from our clients. After analyzing the request I need to generate (compile + link) C++ EXE. What is the best method to create an C++ EXE from a C# application???</p> <p>10x</p>
c# c++
[0, 6]
813,443
813,444
How to set property to Guid in aspx page
<p>I have the following code in one of my aspx pages:</p> <pre><code>&lt;% foreach (Dependency dep in this.Common.GetDependencies(this.Request.QueryString["Name"])) { %&gt; &lt;ctl:DependencyEditor DependencyKey='&lt;%= dep.Key %&gt;' runat="server" /&gt; &lt;% } %&gt; </code></pre> <p>When I run it, I get the following error: <pre><strong>Parser Error Message:</strong> Cannot create an object of type 'System.Guid' from its string representation '&lt;%= dep.Key %>' for the 'DependencyKey' property.</pre></p> <p>Is there any way that I can create a control and pass in a Guid in the aspx page? I'd really hate to have to loop through and create these controls in the code behind just because of that...</p> <p>NOTE: The Key property on the Dependency object <em>is</em> a Guid.</p>
c# asp.net
[0, 9]
5,075,414
5,075,415
how to get value of a #t=querystring in asp.net?
<p>I use Request.QueryString["var"] to pull the value of <a href="http://test.com/test.aspx?var=test" rel="nofollow">http://test.com/test.aspx?var=test</a> into a string</p> <p>the same thing doesn't work for test.aspx#var=test</p> <p>how can I get it from that version of a querystring?</p>
c# asp.net
[0, 9]
4,615,042
4,615,043
Master page - Only one instance of a ScriptManager can be added to the page
<p>I am using ajax toolkit in my project. My project is having a master page and i am inheriting this master page in my web pages.I am using Script manager on every page but now requirement came to display a real time clock also on the master page.I had written the code using Timer to display real time clock on master page but i am getting error "Only one instance of a ScriptManager can be added to the page. ".</p> <p>How to fix this problem as i don't want to remove script manager from the webpages.</p>
c# asp.net
[0, 9]
2,663,636
2,663,637
Android, transmitting between classes?
<p>I have my main class in android, off this I have 2 classes, is there a way to send a message from the sub class to the main class?</p> <p>Thanks for an help!</p>
java android
[1, 4]
1,694,130
1,694,131
honoring rotation lock in android
<p>I am trying to honor the android rotation lock setting - I want my app to display in whatever orientation the home screen is locked in. I found the following knobs:</p> <ol> <li>Settings.System.ACCELEROMETER_ROTATION - determine if the screen orientation is locked.</li> <li>Display.getRotation() - determine if the device is rotated from it's "natural" orientation, which may be portrait or landscape.</li> <li>Display.getWidth()/getHeight() - determine the current orientation of the device.</li> </ol> <p>I thought this would be simple to do, but I can't seem to find the right combination of the above to get this to work. The reported values seem inconsistent, especially during app startup (is onResume the right place to check these values?). </p> <p>Note I don't want to simply always fix the orientation of my activity to portrait or landscape, I want to set it to the orientation the user has locked the screen in. For tablets this could be landscape or portrait. If the user sets the Auto-Rotate setting, I want my activity to operate in sensor mode.</p>
java android
[1, 4]
2,943,228
2,943,229
Referrer stripped when coming from Google site builder page?
<p>Can anyone verify what I am seeing is not a bug? I am checking the referrer when someone comes to my site which is an ASP.NET C# store site. When I link from any of the other sites I control, my main page sees the referrer properly. </p> <p>I am trying to support another third-party site that's linking to me and they have a Google site page at sites.google.com/site/whatever and when I follow that link my referrer on my main page is blank. </p> <p>Is that something Google is doing or is it a truly bizarre bug in my code. (I know you can't see my code but I would like verification that Google is stripping referrer from their sites.google pages please.)</p> <p>Thanks</p>
c# asp.net
[0, 9]
2,900,804
2,900,805
How to append html to <head> with jQuery
<p>I am trying to append a Facebook open graph tag (based on dynamically generated content on the page) to the head of my html.</p> <pre><code> $(document).ready(function(){ var stat = $('#random-message').text(); stat = jQuery.trim(stat); //set facebook Open Graph description $('head').append('&lt;meta property="og:description" content="'+stat+'"/&gt;'); }); </code></pre> <p>this by itself is working fine. <a href="http://jsfiddle.net/mrengy/HQMCz/4/" rel="nofollow">js fiddle</a> </p> <p>When I combine it with a dynamically loaded Twitter script (below)</p> <pre><code>$(document).ready(function(){ var stat = $('#random-message').text(); stat = jQuery.trim(stat); //set tweet button data text $('a.twitter-share-button').attr('data-text',stat); //set facebook Open Graph description $('head').append('&lt;meta property="og:description" content="'+stat+'"/&gt;'); //insert twitter API Script - problematic $('#tweet-like').append('&lt;script type="text/javascript" src="http://platform.twitter.com/widgets.js"&gt;&lt;/script&gt;'); }); </code></pre> <p>it chucks a wobbly. <a href="http://jsfiddle.net/mrengy/2jEXp/1/" rel="nofollow">js fiddle</a> In js fiddle, it inserts some special characters into the body, and none of the rest of the script (including inserting the meta tag) is working. Strange because the Twitter script "widgets.js" is working on my page, but the meta tag does not appear.</p>
javascript jquery
[3, 5]
5,842,934
5,842,935
Refresh div content on form submit (ajax)
<p>On my page I have a form that inserts a new record in to the database. On the same page there is a DIV that contains the current resultset.</p> <p>What I am trying to do is refresh just that DIV (not the whole page) when the form is submitted. The DIV will then contain the latest records (including the one just added).</p> <pre><code>$('#add-variants-form').submit(function(){ $.ajax({ url: 'admin/addvariants', type: 'POST', dataType: 'html', data: $(this).serialize(), }); return false; }); &lt;div id="current-rows"&gt; &lt;?php while($variant=mysql_fetch_array($variants)) { ?&gt; &lt;div class="row"&gt; // resultset &lt;/div&gt; &lt;?php } ?&gt; &lt;/div&gt; </code></pre> <p>I set <code>$variants</code> from within my controller (beforehand):</p> <pre><code>$variants=Catalog::getProductVariants($product['id']); </code></pre> <p>Ideally I don't want to be returning a whole load of HTML to be injected in to that DIV.</p>
php jquery
[2, 5]
1,649,009
1,649,010
Prototype is not working in IE6
<p>This function is not working in IE6 but working in all other browsers. The error is propertyType is undefined and the function does not works for IE6. </p> <p>My function is,</p> <pre><code>function propertyType(){} propertyType.prototype.contactClear=function() { $('#error_msg').text(''); $('#error_msg').css("display","none"); $('#name').val(LANG.LBL_NAME+':'); $('#email').val(LANG.LBL_EMAIL+':'); $('#phone').val(LANG.LBL_PHONE+':'); $('#message').val(LANG.LBL_MESSAGE+': '+LANG.LBL_CONTACT_ME); $("#captchaval").val(''); $("#success_msg").text(''); $('#success_msg').css("display","none"); } var propertyType = new propertyType(); </code></pre> <p>Can anyone suggest me to solve the issue?</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
1,421,022
1,421,023
Evaluate please my js code reliability
<p>I have 2 div tags </p> <pre><code>&lt;div id="div_1" style="width: 100px; height: 100px; background-color: #090"&gt;&lt;/div&gt; &lt;div id="div_2" style="width: 100px; height: 100px; background-color: #900"&gt;&lt;/div&gt; </code></pre> <p>What I want: on mouse out on <code>div_1</code>, remove <code>div_2</code>.</p> <p>But if after <code>div_1</code> onmouseout, mouse cursor is over on <code>div_2</code>, dont remove <code>div_2</code>. this is js code for this:</p> <pre><code> $("#div_1").on("mouseout", function () { $("#div_2").css({ display: "none" }); }); $("#div_2").on("mouseover", function () { $("#div_2").css({ display: "block" }); }); </code></pre> <p>demo <a href="http://jsfiddle.net/Muj3d/" rel="nofollow">http://jsfiddle.net/Muj3d/</a></p> <p>this works good, but I have this question: theoretically how much is this reliable? I ask this because, action <code>div_1 mouseout</code> must be happened before than <code>div_2 mouseover</code> right? </p>
javascript jquery
[3, 5]
222,115
222,116
add next & back buttons for custom gallery
<p>I have this javascript code :</p> <pre><code>$(function(){ $('.words-gallery div:gt(0)').hide(); setInterval(function() { $('.words-gallery &gt; div:first') .fadeOut(1000) .next() .delay(995) .fadeIn(1000) .end() .appendTo('.words-gallery');}, 3000); }); </code></pre> <p>This code will make a gallery from <code>DIVs</code> and every <code>3000</code> will hide the current <code>DIV</code> and show the next one.</p> <p>I was trying to add next &amp; back buttons but it's not working with me.</p> <p>here is my fiddle: </p> <h3><a href="http://www.jsfiddle.net/jUrNx" rel="nofollow">http://www.jsfiddle.net/jUrNx</a></h3> <p>Any idea how to do it?</p>
javascript jquery
[3, 5]
241,194
241,195
How to iterate through table with id='test' and get ids of each row inside table?
<p>How to iterate through table with id='test' and get ids of each row inside table using JQuery ? I need to collect ids in array.</p>
javascript jquery
[3, 5]
2,454,606
2,454,607
Finding controls that use a certain interface in ASP.NET
<p>Having a heckuva time with this one, though I feel I'm missing something obvious. I have a control that inherits from System.Web.UI.WebControls.Button, and then implements an interface that I have set up. So think...</p> <pre><code>public class Button : System.Web.UI.WebControls.Button, IMyButtonInterface { ... } </code></pre> <p>In the codebehind of a page, I'd like to find all instances of this button from the ASPX. Because I don't really know what the <em>type</em> is going to be, just the <em>interface</em> it implements, that's all I have to go on when looping through the control tree. Thing is, I've never had to determine if an object uses an interface versus just testing its type. <strong>How can I loop through the control tree and yank anything that implements IMyButtonInterface in a clean way</strong> (Linq would be fine)?</p> <p>Again, know it's something obvious, but just now started using interfaces heavily and I can't seem to focus my Google results enough to figure it out :)</p> <p><strong>Edit:</strong> GetType() returns the actual class, but doesn't return the interface, so I can't test on that (e.g., it'd return "MyNamespace.Button" instead of "IMyButtonInterface"). In trying to use "as" or "is" in a recursive function, the <em>type</em> parameter doesn't even get recognized within the function! It's rather bizarre. So</p> <pre><code>if(ctrl.GetType() == typeToFind) //ok if(ctrl is typeToFind) //typeToFind isn't recognized! eh? </code></pre> <p>Definitely scratching my head over this one.</p>
c# asp.net
[0, 9]
5,089,535
5,089,536
PHP Display curved paths in google map from one place to another
<p>Displaying curved path from place to another in google map api? I need to display this curve from one airport to another, I am very new to these maps. I have tried some code in google api documentation:</p> <pre><code>var map1 = new GMap2(); map.setCenter(new GLatLng(45.828799,-105.292969), 2); var polyOptions = {geodesic:true}; var polyline = new GPolyline([ new GLatLng(40.65642, -73.7883), new GLatLng(61.1699849, -149.944496) ], "#ff0000", 10, 1, polyOptions); map1.addOverlay(polyline); </code></pre> <p>But i am not getting how to apply this to my scenario. Can please any one answer my question.</p> <p>Thanks and regards.</p>
php jquery
[2, 5]
2,445,510
2,445,511
Setting a JScript variable to contentplaceholder
<p>I have a content page in my ASP.NET-page and want to set a JScript variable to it programatically, so I can use it within the JScript sections of the rendered page afterwards.</p> <p>How can I start with this problem? I have a "head"-content that fills a ContentPlaceHolder in a master page, but have no idea how to write new content into it.</p> <p>I know there are some functions that deal with <code>Page.Controls</code> but I really didn't anything with what I can easily add some content to the... content...</p> <p>I hope someone understands my question and has some advice :)</p>
c# asp.net javascript
[0, 9, 3]
1,985,092
1,985,093
How do I insert multiple image in Edit Text in android
<p>I am trying to insert multiple images in one editText. I have used following code to attach image to EditText</p> <pre><code>txt = (EditText)findViewById(R.id.text); Bitmap bitmap = BitmapFactory.decodeFile(attach); Drawable drawable = new BitmapDrawable(bitmap); txt.setBackgroundDrawable(drawable); </code></pre> <p>But the problem is it only attach one file and show, If i used array then only the last image is only show. at any how it only shows one Image. Is there any way to show multiple images in one Editbox. Thanks in advance.</p>
java android
[1, 4]
2,393,223
2,393,224
Add rows to a table inside a repeater in client side with jquery
<p>I have a repeater which contains a table. I am giving the user the ability to add a new row in the repeater by adding a new row to the table.</p> <p>Can anyone give me ideas? As I am very new to jQuery, can someone give sample code?</p>
c# asp.net jquery
[0, 9, 5]
4,886,069
4,886,070
Issue at Code Access Security assembly file
<p>I am doing exercise on code access security to my project. But I faced one problem while import signed assembly with a strong name. </p> <p>Problem is: </p> <blockquote> <p>The import is failed. The assembly does not appear to be valid. </p> </blockquote> <p>I created signed assembly with a strong name with : <code>sn -k Testkey.snk</code><br> and added to assembly by, <code>[assembly: AssemblyKeyFileAttribute("TestKey.snk")]</code></p>
c# asp.net
[0, 9]
2,442,185
2,442,186
jQuery extension (scope?) question
<p>I have some confusion over a jQuery extension not working as I'd expect. I have the following function defined:</p> <pre><code>$.fn.poster = function() { this.each(function() { self = $(this); self.click(function() { /* does stuff */ $.post(url, data, function(d, t) { handle_storage(d, t, self); }, "json"); }); }); } handle_storage = function(storages, status, caller) { container = $("&lt;div&gt;"); $("&lt;span&gt;").poster().html(storage.name).appendTo($("&lt;li&gt;").addClass("folder").appendTo(container)); } $(function() { $("li.storage span").poster(); }); </code></pre> <p>The initial call to poster() in the ready function works, but inside the handle_storage() callback, I get a "poster() is undefined" error. What gives?</p>
javascript jquery
[3, 5]
355,684
355,685
Calling function to show/hide imageviews from another class
<p>In my MainActivity class I have this method:</p> <p>MainActivity.java</p> <pre><code>public void ClearImageViews() { final ImageView image_a = (ImageView)findViewById(R.id.image_a); image_a.setVisibility(View.INVISIBLE); } </code></pre> <p>And in another file I have another class, which calls ClearImageViews method like this:</p> <pre><code> MainActivity mainActivity = new MainActivity(); mainActivity.ClearImageViews(); </code></pre> <p>Im getting NullPointerExpection while running the code from findViewById function. When I comment out these lines:</p> <pre><code> final ImageView image_a = (ImageView)findViewById(R.id.image_a); image_a.setVisibility(View.INVISIBLE); </code></pre> <p>The code works well. What am I doing wrong? </p>
java android
[1, 4]
2,086,482
2,086,483
How can i do button on hold for two second call function1 if less then two second call function2?
<p>I have this button which is not working correctly for hold button for a period (but it works like click only). </p> <p>Where i was trying to do if the button is <code>hold</code> for greater/equal then 2 seconds then <code>callfunction1</code>, if the button was pressed less then 2 seconds then <code>callfuntion2</code>.</p> <pre><code>var clickDisabled = false; function clickLocker() { /* @Button: 2 seconds */ clickDisabled = true; setTimeout(function(){clickDisabled = false;}, 2000); } function callfunction1() { // you have hold he button for greater then or equal 2 second } function callfunction2() { // you have hold the button less then 2 second } $('.button').live("click",function() { if (clickDisabled) { alert("locked for 2 second"); return; } clickLocker(); }); </code></pre>
javascript jquery
[3, 5]
4,126,007
4,126,008
Loop through all checkboxes that are inside a div tag
<p>I need to loop through all checkboxes that are inside a div tag with id #abc123</p> <p>How can I do this?</p> <pre><code>$("#abc123").foreach( ???? ) </code></pre> <p><b>Update</b> my html row looks like:</p> <pre><code>&lt;tr&gt; &lt;td&gt;&lt;input .../&gt; &lt;/td&gt; &lt;td&gt;234&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I need to add the value of the <code>&lt;td&gt;</code> into the ID of the checkbox.</p> <p>Would I just get the parent, then ancestor it somehow?</p>
javascript jquery
[3, 5]
3,870,598
3,870,599
How to pause execution of javascript till jquery fade finishes
<p>I want to do something like this</p> <ol> <li>Fadein a div that covers some other div</li> <li>change contents of that some other div</li> <li>fadeout covering div and reveal that some other div below it.</li> </ol> <p>Here is a code for that:</p> <pre><code>$pH('#coveringDiv').fadeIn(300); //want to start doing something now, but only after above fadeIn finishes adContainer = $pH(currAdBubble).find('.mcc'); $pH(adContainer).empty().html("some html"); $pH('.phAdScroller').attr('kw',keyword); setTimeout("$pH('#coveringDiv').fadeOut(500);",300); </code></pre> <p>but what happens is, <code>fadeIn</code> and code written after that start together. i want code below fadeIn to start only after <code>fadeIn</code> finishes. I tried an empty <code>setTimeout</code>, but that didn't help as well. It would be too weird to put that code in a function and call it in <code>setTimeout()</code> as there will be a need to pass many arguments to that function. So how to achieve this ?</p>
javascript jquery
[3, 5]
790,364
790,365
Why isn't my EventHandler firing? (Asp.Net C#)
<p>I am programatically making some LinkButtons, and they worked fine for a while, but now the events aren't firing and I can't figure out why?</p> <p>This is what makes the button:</p> <pre><code>protected void MakeUploadButton(attachment a, PlaceHolder ph) { LinkButton lb = new LinkButton() { Text = "Upload New " + a.attachment_type.type_name, CssClass = "button right", ID = "lb" + a.attachment_type.file_tag, CommandArgument = a.attachment_type_id.ToString(), CommandName = a.attachment_type.type_name, CausesValidation = false }; lb.Click += new EventHandler(showModalPopup); lb.DataBind(); ph.Controls.Add(lb); } </code></pre> <p><strong>ShowModalPopup</strong> exists and all, but when I run it in Debug, nothing inside of it ever fires... for some reason, it is not getting called. Any ideas?</p>
c# asp.net
[0, 9]
1,742,779
1,742,780
how to fire event on file select
<p>I've a form as</p> <pre><code>&lt;form onSubmit="return disableForm(this);" action="upload.php" method="post" name="f" id="wizecho" enctype="multipart/form-data"&gt; &lt;input type="file" name="file" /&gt; &lt;button onClick="return disableForm(this),ajaxUpload(this.form,'wizecho_upload.php', '&amp;lt;br&amp;gt;Uploading image please wait.....&amp;lt;br&amp;gt;'); return false;"&gt; Upload Image &lt;/button&gt; &lt;/form&gt; </code></pre> <p>It is to upload an image.</p> <p>Here I need to click on the button to upload the image and I've to use <code>onClick</code> event. I want to remove the upload button and as soon as the file is selected at the input, I want to fire the event. How do I do that??</p>
javascript jquery
[3, 5]
5,861,581
5,861,582
jquery show only child
<p>I have a problem : I use classes on a div for simplicity, I would like to show a hidden div after a click, but only on that div, the problem is it shows on all divs, and I can't seem to get it working, here is a jsfiddle with the problem : <a href="http://jsfiddle.net/cWNvT/" rel="nofollow">http://jsfiddle.net/cWNvT/</a></p> <p>HTML:</p> <pre><code>&lt;div class="left"&gt; &lt;a href="#" class="edit-click"&gt;Edit&lt;/a&gt; &lt;div class="edit"&gt; &lt;p&gt;edit here&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="left"&gt; &lt;a href="#" class="edit-click"&gt;Edit&lt;/a&gt; &lt;div class="edit"&gt; &lt;p&gt;edit here&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="left"&gt; &lt;a href="#" class="edit-click"&gt;Edit&lt;/a&gt; &lt;div class="edit"&gt; &lt;p&gt;edit here&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>JavaScript:</p> <pre><code>$(document).ready(function() { $('.edit').hide(); $('.left a.edit-click').click(function() { $('.left').children().show(); }); });​ </code></pre> <p>Anyone have a solution for this ?</p>
javascript jquery
[3, 5]
5,665,825
5,665,826
How to optimize my if statements or make less if statements?
<pre><code>if(varName1 &lt;= 1 &amp;&amp; varName1 &gt; 0) { $('#id1').addClass('ClassName'); } if(varName2 &lt;= 2 &amp;&amp; varName2 &gt; 1) { $('#id1').addClass('ClassName'); $('#id2').addClass('ClassName'); } if(varName3 &lt;= 3 &amp;&amp; varName2 &gt; 2) { $('#id1').addClass('ClassName'); $('#id2').addClass('ClassName'); $('#id3').addClass('ClassName'); } </code></pre> <p>So basically I am wondering if there is a better way to do this with less if statements(8 total with same pattern).</p>
javascript jquery
[3, 5]
714,125
714,126
Javascript comparison help
<p>I am having trouble with this statement and I was hoping I could get some help. Essentially, if <code>edweek</code> and <code>edevenings</code> (which are checkboxes) are not equal then I want to push to my array. The problem I am having is that I can get one of the values to be not equal, but when I add the second it doesn't work.</p> <pre><code>function getEdVals() { var edVals = []; $('#edinitiativecont :checked').each(function() { if($(this).val() == $("#liveweb").val()){ edVals.push($(this).val()); } else { if($(this).val() == (!($("#edweek").val()) || $("#edevenings").val())){ edVals.push($(this).val()); } } }); } </code></pre>
javascript jquery
[3, 5]
320,784
320,785
Click function inside for loop
<p>I am trying to loop my .hide() and .show() click handlers and I can't get this simple part to work correctly. My buttons are called "#towelcome" etc. I'm assuminig I'm missing something stupid and obvious. All of the divs are hidden in css. </p> <pre><code>var elements = ["welcome", "slides", "projects", "pages"]; for (i=0;i&lt;=elements.length-1;i++){ $("#to"+elements[i]).click(function() { $("#"+elements[i]).show(); }); } </code></pre> <p>/UPDATE:------------------------------------------------------------------------</p> <p>The following code is the code I am trying to minify.</p> <pre><code>$("#toprojects").click(function(){ $("#projects").show(); $("#slides").hide(); $("#pages").hide(); $("#welcome").hide(); }); $("#toslides").click(function(){ $("#projects").hide(); $("#slides").show(); $("#pages").hide(); $("#welcome").hide(); }); $("#topages").click(function(){ $("#projects").hide(); $("#slides").hide(); $("#pages").show(); $("#welcome").hide(); }); if(window.location.hash === "#slides"){ $("#projects").hide(); $("#slides").show(); $("#pages").hide(); $("#welcome").hide(); } if(window.location.hash === "#projects"){ $("#projects").show(); $("#slides").hide(); $("#pages").hide(); $("#welcome").hide(); } if(window.location.hash === "#pages"){ $("#projects").hide(); $("#slides").hide(); $("#pages").show(); $("#welcome").hide(); } </code></pre> <p>found a related post here and it solved it pretty nicely <a href="http://stackoverflow.com/questions/494161/jquery-set-click-from-array-loop">jQuery: Set click from array loop.</a></p>
javascript jquery
[3, 5]