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
5,617,456
5,617,457
how to set longest li element's width as width of all li elements that belong to single parent ul
<p>hi i have an unordered list like this</p> <pre><code>&lt;ul class="dropdown"&gt;Home &lt;li&gt;kithchen &lt;/li&gt; &lt;li&gt;Meeting room&lt;/li&gt; &lt;li&gt;garden&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>When I MouseOver on home, the width of all <code>&lt;li&gt;</code> elements coming under home shuld be the width of longest element. For example here 'meeting room' is longest.</p> <p>I need to do this using jquery</p> <p>Thanks in advance</p> <p>the css file i have wriiten for the menu is like this ul{ list-style: none;}</p> <pre><code>/* LEVEL ONE */ ul.dropdown {text-align:left; position:relative;z-index:1; width:1000px;} ul.dropdown li { font-weight: bold;border:1px solid green; float:left;color:white;background: black;width:100% } ul.dropdown a:hover { color: white; } ul.dropdown a:active { color: white; } ul.dropdown li a { text-align:left; display:inline; padding:4px; color:white;} ul.dropdown li:last-child a { border-right: none; } /* Doesn't work in IE */ ul.dropdown li:hover { background: orange; color: white; position:relative; } * { margin: 0; padding: 0; } /* LEVEL TWO */ .dropdown ul { width: 220px; visibility:hidden; position:absolute; left: 0; } ul.dropdown ul li { font-weight: normal; background:black; color: white; float:left; } /* IE 6 &amp; 7 Needs Inline Block */ ul.dropdown ul li a {color:White; border-right: none; width:180px; display: inline-block; } /* LEVEL THREE */ ul.dropdown ul ul { left: 100px; top: 0; } ul.dropdown li:hover &gt; ul { visibility: visible;} </code></pre>
jquery asp.net
[5, 9]
5,280,069
5,280,070
state of activity saving in android when home button pressed
<p>I am having an issue related to home key . when i press home key all current activity gets hidden . but when i press the executable it again starts from the fisrt screen . I have overidden all methods onsaveInstaceState opPause onStop onResume but there are still issues what is the right way to handle those conditions . When i am pressing home button i am storing the widgets state in database and when i again click the exectable i am checking the database state and starting the new Intent as saved when user presses the home button .Is it the right way to do that as i am facing the problem when user does the same and again presses the back button , there is already on intent available in stack of activity . Thanks in advance.</p>
java android
[1, 4]
243,401
243,402
"Please wait..." between two page is not working correctly
<p>I have login page which contains some images and ajax contorls, when this page gets refresh all layout and the way page appears, totally awkward. So, after quick searching in the google, I have taken a javascript method and calling this in page load event like this(), it's working fine but only after refreshing the page, means after loading page completely page is being shown.</p> <p>But, problem still remains because before refreshing, page again starts with same awkward condition. So, do I need to call javascript method as soon as my page gets refresh or need to work on my css. Here is my javascript code....</p> <pre><code> function hideBodyloader() { document.getElementById("bodyloader").style.display = "none"; } </code></pre> <p>and css for div....</p> <pre><code> #bodyloader { position: fixed; width: 100%; height: 100%; top: 0; left: 0; z-index: 1000000000; background-color: white; display: block; } .bodyloader { text-align:left; color: Black; font-size: 13px; font-family: Arial, Helvetica, sans-serif; } </code></pre> <p>If there is another way to achieve this please advise me too, but should be on page refresh not on button event.</p> <p>Thanks in advance, any suggestion would be appreciated.......:)</p>
c# asp.net
[0, 9]
2,183,040
2,183,041
JavaScript/jQuery and "top-level" functions
<p>When I peruse a jQuery-driven JavaScript source file, I see functions defined like so:</p> <pre><code>$(document).ready(function() { ... }); $(function { ... }); </code></pre> <p>I <em>think</em> I understand the first one: I assume its a function to fire once the entire page is downloaded, yes? If not please correct me!</p> <p>What really confuses me is the second one. Is this an anonymous function? How/where does it get called? When does it get called (page load)?</p> <p>I guess I'm used to seeing JavaScript function written the <em>old</em> way:</p> <pre><code>function myFunction() { ... } </code></pre> <p>Then I just call <code>myFunction</code> anytime I need it. How does this "old" way compare to jQuery's constructs? Thanks for helping me understand any of this confusion!</p>
javascript jquery
[3, 5]
5,790,578
5,790,579
Having a error with implementing add task into my project
<p>I have ad task manager working in another projec, but when I converted the code it gave me an error when I tried to run it. The error is <pre><code>E/AndroidRuntime(681): java.lang.RuntimeException: Unable to start activity ComponentInf {com.screenssample/com.sudarmuthu.android.taskmanager.ViewTasksActivity}: java.lang.ClassCastException: android.app.Application</code></pre> and I do not know how to find errors by debugging it, but shouldn't be any errors if it works in another project correct? </p>
java android
[1, 4]
1,480,793
1,480,794
is there a javascript (or jquery) short cut for "function(){return false;}"?
<p>It seems like I type "function(){return false;}" some what too frequently too prevent actions from happening... is there a short cut?</p>
javascript jquery
[3, 5]
4,900,141
4,900,142
Place random positioned element into a document in vertical axes
<p>I have the following code</p> <pre><code>function randomizer(start, end) { return Math.floor((end - start) * Math.random()) + 1; } var top_pos = randomizer(1, $(document).height()); $('.element_selector').css('top', top_pos + 'px'); </code></pre> <p>but the result is not what I realy expect from. The most of the times the element is places near to top (about 80% of the times).</p> <p>Is there any better solution to place my random element in realy random position into vertical axes ?</p>
javascript jquery
[3, 5]
2,194,944
2,194,945
gaming with c++ or c#?
<p>What is the best language for programming a game project and why?</p> <p>Why is the game programing world dominated by c++?</p>
c# c++
[0, 6]
1,146,423
1,146,424
jquery append only appends in first element of list or shows error [object Object]
<p>I have a variable <code>var $deleteEl = $('&lt;a class="upload_delete" href="#"&gt;Delete&lt;/a&gt;');</code> which is a delete link that need to be created next to each uploaded image. html structure is next:</p> <pre><code>&lt;ul id="thumb_galery"&gt; &lt;li class="thumb"&gt; &lt;img&gt; &lt;a class="upload_delete"&gt;&lt;/a&gt; &lt;/li&gt; &lt;li class="thumb"&gt; &lt;img&gt; &lt;a class="upload_delete"&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>for every uploaded image, thumb with image is appended to thumb_galery</p> <pre><code>$(thumb_galery).append('&lt;li id="thumb"&gt;&lt;img src="img/success.jpg" alt="' + fileName + '"&gt;&lt;/li&gt;'); </code></pre> <p>i need to add delete link in the same <code>li</code> next to the image as provided in html structure.</p> <p>If i append delete link like this</p> <pre><code>$(thumb).append($deleteEl); </code></pre> <p>it works great for first image uploaded, but for next images it only appends it to the first <code>li</code> with class thumb.</p> <p>How can the delete link be appended in <code>li</code> for the next uploaded image?</p> <p>The other solution i tried is to place a variable in the first append like this</p> <pre><code>$(thumb_galery).append('&lt;li class="thumb"&gt;&lt;img src="img/success.jpg" alt="' + fileName + '"&gt;' + $deleteEl + '&lt;/li&gt;'); </code></pre> <p>This creates the perfect html structure but instead of delete link it shows [object Object]</p>
javascript jquery
[3, 5]
2,224,643
2,224,644
Recording audio in android
<p>I want to record own voice or any through mic(In any way) into a file in my project and want to read later and listen to it.How can i do this? Anyone reply me please.</p>
java android
[1, 4]
3,993,270
3,993,271
Access session in class library.
<p>I am developing an application architecture that uses 2 sub projects: a) asp.net web application (it covers user interface and business logic) and b) class library. (it covers data access layer)</p> <p>After system user successfully logs in , the user information is stored in a session object.</p> <p>The problem I am facing is when I try to access that session object in class library project(data access layer), it always returns null.</p> <p>I need to access the session object in class library project because, in my case each user has their own username and password for database access(for security reasons);</p> <p>So, How how do i read and write from/to session object in class library project</p>
c# asp.net
[0, 9]
3,092,841
3,092,842
Cross-browser background Y position animation?
<p>I'm currently using this to animate background positions:</p> <pre><code>$('#icon' + n).animate({ backgroundPositionY : "-=5px" }, 250 ); $('#icon' + n).animate({ backgroundPositionY : "+=5px" }, 250 ); </code></pre> <p>Chrome is warning me <code>backgroundPositionY</code> will be deprecated, also it get's buggy if zoom is different than 100% and Firefox and Explorer don't even run the animation.</p> <p>What is the correct method to animate background Y position?</p>
javascript jquery
[3, 5]
2,125,967
2,125,968
How to use jQuery to select all text inside paragraph after specific character
<p>I would like to use jQuery to find specific character, in this case "#" inside one or more paragraphs, remove that character, and wrap everything after in span tag.</p> <p>Here is HTML example:</p> <pre><code>&lt;p&gt;Lorem ipsum dolor sit amet # consectetur adipiscing elit&lt;p&gt; </code></pre> <p>And jQuery should convert code above into this:</p> <pre><code>&lt;p&gt;Lorem ipsum dolor sit amet &lt;span&gt;consectetur adipiscing elit&lt;/span&gt;&lt;/p&gt; </code></pre> <p>I spent few hours on this already and I know solution should be relatively simple, but I can't find it. Is there any jQuery guru willing to help? Thanks!</p>
javascript jquery
[3, 5]
1,271,060
1,271,061
How to know what country codes navigator.userLanguage; returns for all countries?
<p>I'm using the following code to detect the language and country of a visiting user of site. According to this <a href="http://www.w3schools.com/jsref/prop_nav_userlanguage.asp" rel="nofollow">http://www.w3schools.com/jsref/prop_nav_userlanguage.asp</a>, it returns the operating system's natural language settings. So it actually returns the OS settings of the user.</p> <p>My question, how do know I know all the codes that, that function returns for all countries and languages? Is there a list somewhere? For example in Spain it returns es-ES.</p> <p>Thanks!</p> <pre><code>var userLang = (navigator.language) ? navigator.language : navigator.userLanguage; </code></pre>
javascript jquery
[3, 5]
3,673,269
3,673,270
Did jQuery kill the JavaScript discussions?
<p>There are over 100,000 questions on Stack Overflow tagged as questions relating to JQuery troubleshooting/usage. Compare this to the 124,000 questions on stack overflow that are tagged for JavaScript issues. We are very close to almost half of all JavaScript related questions on Stack Overflow being attributed to JQuery (plus or minus any margin for the few other JS frameworks that get questions on SO).</p> <p>What I'm getting at is, jQuery is not a language and it is not the be all and end all of frameworks that must be applied to every scenario in which JavaScript is present, yet it is quickly catching (and I predict will soon eclipse) JavaScript as a source of discussion/inquiry on sites like Stack Overflow.</p> <p>Is jQuery killing the JavaScript star? Is there no longer a firm grasp by the next generation of web developers regarding the power, simplicity and use of JavaScript as a means for DOM manipulation? Is this just the natural evolution of things and the viewpoint I'm presenting typical of the coder's ego (i.e., is this how assembly programmers view the .NET/Java/Web crowd?) or is this really the beginning of the end of the true JavaScript developer? </p>
javascript jquery
[3, 5]
506,488
506,489
How to get $(this) selected option in jQuery?
<p>The following code works:</p> <pre><code>$("#select-id").change(function(){ var cur_value = $('#select-id option:selected').text(); . . . }); </code></pre> <p>How to refactor the second line to:</p> <pre><code>var cur_value = $(this).***option-selected***.text(); </code></pre> <p>What do you use for <code>***option-selected***</code>?</p>
javascript jquery
[3, 5]
3,249,766
3,249,767
redirect to another page if javascript is disabled
<p>i have a alot of functionality implemented through javascript if at any stage the javascript is disabled he should be redirected to another page. mentioning him to enable the javascript and then proceed. and this functionality should be cross browser compatable Regard,</p>
javascript asp.net
[3, 9]
721,730
721,731
Custom WebControl using jQuery that needs to work inside an UpdatePanel
<p>I have created a custom server side WebControl. This control calls an initialization script that uses jQuery to hookup the events with calls to bind when the page is loaded. </p> <p>This control is now being used inside an UpdatePanel and obviously the client side events no longer exist after the UpdatePanel does it's thing. So, I need to re-run my initialization script if the control has been re-rendered as part of a partial page refresh and I don't see a good way of doing this.</p> <p>I am aware of the ScriptManager.IsInAsyncPostBack and UpdatePanel.IsInPartialRendering, but they don't seem to provide what I need. It seems to implement this correctly that I will have to check if ScriptManager.IsInAsyncPostBack==true, then search up the control tree for an UpdatePanel that has IsInPartialRendering==true. If I find such an UpdatePanel then I re-run my initialization script.</p> <p>Sounds horrible. Am I missing something simple? I can't be the only one who lives this way.</p> <p>Thanks for reading!</p>
asp.net jquery
[9, 5]
5,458,806
5,458,807
call click function method but not if it has another class associated
<p>I have the following code:</p> <pre><code> $('#commentContainer').delegate('div.comment-vote div.vote', 'click', function () { //etc } </code></pre> <p>I want this to get called but not when the div.vote also has a class "unauthenticated"</p> <p>how can i do that?</p> <pre><code>&lt;div class="vote"&gt;&lt;/div&gt;//this one when clicked call click function in delegate &lt;div class="vote unauthenticated"&gt;&lt;/div&gt;//this one do nothing. </code></pre>
javascript jquery
[3, 5]
3,444,478
3,444,479
How to refresh the size of a div after adding elements to it
<p>I have an element like this:</p> <pre><code>&lt;div id="content" style="border: 2px solid black"&gt; &lt;/div&gt; </code></pre> <p>And through JQuery I add some new stuff:</p> <pre><code>$("#content").append($('&lt;div&gt;&lt;/div&gt;').addClass("box")); </code></pre> <p>where</p> <pre><code>.box { margin: 10px; padding: 10px; border: 1px solid black } </code></pre> <p>But the outer <code>div</code> does not resize when I do this, so I get an inner box that is sticking out of a solid outer box. How can I get the outer box to resize itself when I add this inner box?</p>
javascript jquery
[3, 5]
3,112,874
3,112,875
how to split the values of column in datatable of dataset?
<p>In my dataset I have many rows,</p> <pre><code>In first row last column has the value is "12356.56@Firefox 1@23423" In Second row same column has the value is "[email protected]@23423" In Third row same column has the value is "3423@Firefox 14.0@sdfsd" </code></pre> <p>here instead of displaying same value like above..</p> <pre><code>I need to display just "Firefox" if that column has Firefox in UI I need to display just "Chrome" if that column has Chromein UI </code></pre> <p>how can i do it...</p>
c# asp.net
[0, 9]
2,404,780
2,404,781
How to start activity after VideoView end
<p>I have Activity , in this activity i have video . After this video i wish run another activity . I try make stupid things in java :) but it doesnt work . Help me pls . My clear java code without my stupid ideas :) I hope you help me :)</p> <pre><code>package com.mem.good; import android.app.Activity; import android.net.Uri; import android.os.Bundle; import android.view.Window; import android.view.WindowManager; import android.widget.MediaController; import android.widget.VideoView; public class MemActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); setContentView(R.layout.main); VideoView videoView = (VideoView) findViewById(R.id.videoview); MediaController mediaController = new MediaController(this); mediaController.setAnchorView(videoView); Uri video = Uri.parse("/sdcard/memapp/load.mp4"); videoView.setVideoURI(video); videoView.start(); } } </code></pre>
java android
[1, 4]
4,312,479
4,312,480
Getting a PHP variable in jQuery
<p>So I have this:</p> <pre><code>&lt;?php echo ' &lt;script&gt; $(function(){ $("a#yeah").click(function(){ $.ajax({ url: "ajax.php?action=yeah&amp;id='.$id.'", success: function(html){ $("a#yeah").html("your cool") } }) }) })&lt;/script&gt;'; ?&gt; </code></pre> <p>basically I am using the PHP variable $id wich can be find in the document, how could i get this same variable but without echoing the jQuery(so i could keep my editor syntax highlight in the Javascript part)?</p>
php jquery
[2, 5]
1,379,354
1,379,355
How to set and get id of a view
<p>I have 2 queries:</p> <p>1). I want to display kind of screen lik</p> <pre><code>Heading ImageButton1 ImageButton2 Value1 Value2 </code></pre> <p>Same way number of records</p> <p>So i have used absolute layout programmatically instead of using xml, is it advisable or there is some other way?</p> <p>2). At that time of displaying this view, i have to set unique Id to each record and get Id whenever any of 2 buttons pressed of any record. Can anyone tel me how is that possible? Means in short how to set and get id which button of which record is selected??</p> <p>Thanks in advance.</p>
java android
[1, 4]
2,807,552
2,807,553
Looping through elements added on the fly
<p>If for example I have the following HTML structure</p> <pre><code>&lt;ul class="actions"&gt; &lt;li class="action"&gt;Action 1&lt;/li&gt; &lt;li class="action"&gt;Action 2&lt;/li&gt; &lt;li class="action"&gt;Action 3&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>And the following Javascript</p> <pre><code>$('.actions .action').each( function() { perform an ajax request // intended pseudocode if ajax returns some more actions { // intended pseudocode $('.installer-actions').append('&lt;li class="action"&gt;Another Action&lt;/li&gt;'); } }); </code></pre> <p>The added <code>&lt;li class="action"&gt;</code> elements are not included in the <code>each()</code> obviously. Is there a way I can involve them in the current loop or will I need to loop through again and ignore the original <code>.action</code> elements?</p>
javascript jquery
[3, 5]
1,272,020
1,272,021
replacing Enter key code with TAB key code in jQuery
<p>I have a script in javascript that replace <kbd>Enter</kbd> with <kbd>TAB</kbd> key:</p> <pre><code>function ReplaceEnterWithTab() { if (event.keyCode == 13) event.keyCode = 9; return false; } </code></pre> <p>and I use it this way:</p> <pre><code>txt.Attributes.Add("OnKeyDown", "ReplaceEnterWithTab();"); </code></pre> <p>this code work nice.Now I want to develop a script with jQuery that will not need to add <code>OnKeyDown</code> attribute.please consider this sample page:</p> <pre><code>&lt;form id="form1" runat="server"&gt; &lt;div&gt; &lt;asp:TextBox ID="TextBox1" runat="server" CssClass="EntTab"&gt;&lt;/asp:TextBox&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:TextBox ID="TextBox2" runat="server" CssClass="EntTab"&gt;&lt;/asp:TextBox&gt; &lt;br /&gt; &lt;br /&gt; &lt;asp:DropDownList ID="DropDownList1" runat="server" CssClass="EntTab"&gt; &lt;asp:ListItem&gt;1&lt;/asp:ListItem&gt; &lt;asp:ListItem&gt;2&lt;/asp:ListItem&gt; &lt;/asp:DropDownList&gt; &lt;asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /&gt; &lt;/div&gt; &lt;/form&gt; </code></pre> <p>I write this code :</p> <pre><code>$(document).ready(function () { $('.EntTab').on('keydown', function (e) { if (e.keyCode == 13) e.keyCode = 9; }); }); </code></pre> <p>the problem is when I press <kbd>Enter</kbd> key on <code>TextBox1</code>, <code>Button1</code> cause page post back. How I can solve this issue?</p> <p>thanks</p>
javascript jquery asp.net
[3, 5, 9]
3,329,170
3,329,171
display "page loading" message
<p>I'm trying to display an image (.gif) for "page loading" in html page until the output from my_script.py gets displayed, and I've no idea how to do that. <a href="http://jsfiddle.net/9X4gW/" rel="nofollow">This</a> is what I've got so far. Many thanks in advance.</p> <p><strong>HTML:</strong></p> <pre><code>&lt;div id="loading"&gt; &lt;p&gt;&lt;img src="./images/loading.gif" /&gt; Please Wait&lt;/p&gt; &lt;/div&gt; &lt;form action="./cgi-bin/my_script.py" method="post" enctype="multipart/form-data" name="fname"&gt; &lt;input type="submit" id="submit" value="Submit" /&gt; &lt;/form&gt; </code></pre> <p><strong>js:</strong> </p> <pre><code> $(document).ready(function() { $("form").submit(function() { showLoading(); $('#content').load('./cgi-bin/my_script.py', null, showResponse); }); function showResponse() { hideLoading(); } function showLoading() { $("#loading").show(); } function hideLoading() { $("#loading").hide(); } }); </code></pre>
javascript jquery
[3, 5]
5,327,184
5,327,185
Surprising value assignment due to operator precedence?
<p>I have this code (fiddle is too slow right now, sorry)</p> <p>UPDATE: Sorry, I completely missed the boat here. </p> <p>Here is the code I meant to write and it works without the ""</p> <pre><code>$(function() { var x=0,y=1; var inputs = $("#div_id").find("input:text"); var y = Math.ceil(inputs.size()/2); inputs.each(function (i, input) { $(this).prop("value",(i % 2 == 0)?++x:++y); }); }); </code></pre> <hr> <p>Original question based on completely wrong logic :O</p> <pre><code>$(function() { var x=0,y=1; $("#div_id").find("input:text").each(function (i, input) { $(this).val(""+(i % 2 == 0)?x++:y++); }); }); </code></pre> <p>If I remove the ""+ from the value, I get this wrong result</p> <p><img src="http://i.stack.imgur.com/aH9Ag.png" alt="enter image description here"></p> <p>instead of what I want, which is this:</p> <p><img src="http://i.stack.imgur.com/bkjrz.png" alt="enter image description here"></p> <p>Same if I use prop: </p> <pre><code> $(this).prop("value",""+(i % 2 == 0)?x++:y++); </code></pre> <p>Same if I prefix the ++</p> <p>What am I overlooking? Is this an obvious thing?</p>
javascript jquery
[3, 5]
23,433
23,434
Javascript object retrival
<p>Using Javascript objects, when I execute the code below, the second alert doesn't work. It returns <code>undefined</code>.</p> <pre><code> &lt;script&gt; var operations = {"Create" : "POST", "Read" : "GET", "Delete" : "DELETE" }; //result POST alert(operations.Create); var method="Create"; alert(operations.method); &lt;script&gt; </code></pre> <p>How do I get it to return the value of the "Create" property I created at the beginning of the script?</p>
javascript jquery
[3, 5]
3,342,520
3,342,521
jQuery - don't fire 'click' on 'mousemove'
<p>I created a <a href="http://jsfiddle.net/syTKq/" rel="nofollow">Fiddle</a> to demonstrate my situation.</p> <p>I want to not fire the click event when the user is panning--only if it's just a simple click. I've experimented with different placements of .off() and .on() to no avail.</p> <p>Thanks in advance for your help.</p>
javascript jquery
[3, 5]
4,319,265
4,319,266
how to send bubble message in android
<p><img src="http://i.stack.imgur.com/3HmZe.png" alt="enter image description here"></p> <p>I am using a custom list adapter...to display message i want change it to bubble message... <code>this.ListAdapter = new IndMessageAdapter(this, R.layout.chatmessage_list, Messages);</code></p> <hr> <p>Criteria s:</p> <p>1.Bubble should expand according the message length...</p> <p>2.bubble not shrink or....change it resolution??</p> <p>any idea how to proceed??</p> <hr>
java android
[1, 4]
4,680,816
4,680,817
Set a timer to a print window
<p>Can we create a timer function for print window in jquery or javascript,My intention was to set a timer so that the the print window closes successfully by itself when the user doesnt perform any operation on it.</p>
javascript jquery
[3, 5]
4,971,984
4,971,985
convert 1,00 to 100 in .Net
<p>How do I convert the number "1,00" to "100" in .Net?</p> <p><strong>Clarification:</strong> I have this code:</p> <pre><code>VALOR = order.Total.ToString("#0.00"); </code></pre> <p>It returns the text "1,00" but I need "100" (without comma).</p>
c# asp.net
[0, 9]
615,230
615,231
Give me script for when click on checkbox then display another checkboxes using javascript or jquery
<p>I want to help for the when click on the checkbox then display multiple checkboxes using jquery or javascript. Pls give me help.</p>
javascript jquery
[3, 5]
5,068,326
5,068,327
jQuery POST to PHP doesn't get to success function
<p>I have a simple jQuery post function that calls PHP script in order to return value from the database.</p> <p>In Firebug I see that the PHP file is being called with 200 OK status, however the success function in JS is not being called.</p> <p>To test the problem I have changed the PHP to only echo a simple string, but it doesn't work as well.</p> <p>When I view the PHP file directly in the browser I do see the echoed string.</p> <p>Here is the JS code:</p> <pre><code>$.post(PATH + "load.php", { id: _id }, function (data) { console.log("LOADED " + data); }); </code></pre> <p>And here is the simple PHP code:</p> <pre><code>&lt;? echo "bla bla bla" ?&gt; </code></pre> <p>I don't know what the problem is. My HTML+JS file is local and it calls an online PHP file. Maybe this is the reason? Any help will be appreciated.</p>
php javascript jquery
[2, 3, 5]
2,645,758
2,645,759
How can I change the position of the input cursor in text fields to be right justified for arabic text
<p>Arabic writing starts from right to left but the blinking cursor is on the left side. is there a way to program it or configure it to be positioned on the right?</p>
javascript jquery
[3, 5]
4,579,074
4,579,075
How come the answer to every javascript question ends up being "jQuery"
<p>I've been following the javascript questions here for the last few weeks, and I've found a common recurring theme.</p> <p>Almost any question asked on here that involves JavaScript gets answered with:</p> <ol> <li>"jQuery can do that"</li> <li>"there's a plugin for that"</li> <li>"jQuery can make your bed for you." </li> </ol> <p>Even questions referencing other libraries are answered by saying "Use jQuery instead".</p> <p>Is jQuery replacing JavaScript as a whole?<br> This is a serious question. Are we really looking at JavaScripts future. Obviously this community has a strong bias towards jQuery (is that because there's alot of .NET developers?), but does the web development community as a whole share this bias?</p>
javascript jquery
[3, 5]
5,832,447
5,832,448
File Name in ASP.NET Response Buffer
<p>When doing something like this:</p> <pre><code>Response.Clear(); Response.OutputStream.Write(buffer, 0, buffer.Length); Response.ContentType = "audio/mpeg"; Response.Flush(); </code></pre> <p>The downloaded file name is "Default.aspx". How can I change it to something like "a.mp3"?</p>
c# asp.net
[0, 9]
1,578,580
1,578,581
attaching a script dynamically using jQuery
<p>I have a problem which have been troubling me for the last few days. I have to implement tracking to my website simply by adding a script tag as shown below.</p> <pre><code>&lt;script src="domain"&gt; </code></pre> <p>However I need to attach the script tag once a javascript event is fired. I made some research and discovered this can be achieved using jQuery .getScript() function. Sample code shown below.</p> <pre><code>$('body').bind("success", function(e, data) { // Call for the tracking scipt here $.getScript("domain", function() {}); }); </code></pre> <p>My problem is that the loaded script contains the below code:</p> <pre><code>document.write(&lt;img src='domain'/&gt;); </code></pre> <p>Unfortunately this code is not executed, (I am guessing since the DOM is already loaded at the time I am attaching the script, the document.write() function will not work.) I also tried using native javascript code as shown below to no avail.</p> <pre><code>var body = document.getElementsByTagName("body")[0]; var script = document.createElement('script'); script.type = "text/javascript"; script.src = "domain"; body.appendChild(script); </code></pre> <p>At the moment I have managed to achieve this by placing the scipt tag in a seperate page and then load the page in an invisible iFrame from the fired JS event. I don't really like this idea, so any help would be appreciated.</p>
javascript jquery
[3, 5]
2,127,915
2,127,916
Open link on click with jquery after att id append
<p>Hi guys i have a situation like this</p> <pre><code>&lt;div class="todos-pedidos" title="/pedidos"&gt;See More&lt;/div&gt; </code></pre> <p>When click this div its expand my UL / LI with this jquery</p> <pre><code>$('.todos-pedidos').click(function() { $('#bloco-pedidos-andamento ul li:hidden:lt(2)').slideToggle(); if( ! $('#bloco-pedidos-andamento ul li').is(':hidden') ) $('.todos-pedidos').html("&lt;span class='todos-pedidos2'&gt;See All&lt;/span&gt;"); return false; </code></pre> <p>when there is no more LI to expand the button change the div text</p> <p>so i m try for after change the text from see more to see all if the visitor clicks again this go to a url</p> <p>i tried like this but i think there is some error or conflict, the link dont open</p> <pre><code>$("span.todos-pedidos2").click(function(event){ event.preventDefault(); var link = $('.todos-pedidos').attr("title"); location.href=link; }); </code></pre> <p>thanks for any help</p>
javascript jquery
[3, 5]
5,909,146
5,909,147
What the most efficient way of monitoring changes to data on an ASP.Net form?
<p>I have an ASP.Net form and I want to send an email when the user changes their data. The email should only include data that has changed, and there are about 15 data fields total.</p> <p>I don't want to use an ORM since I am updating a website that a 3rd party built for us, and all their data access calls go through a custom library of theirs.</p> <p>The only ways to do this I can think of is</p> <ul> <li><p>Make another database call to get old values and compare the form values one-by-one. If they're different, append to the email.</p></li> <li><p>Store original data somewhere when it's first loaded (hidden field, session, etc), and once again compare the data one field at a time and append the differences to an email</p></li> <li><p>Have someone on SO tell me there's an easier and/or simpler way that I haven't thought of</p></li> </ul>
c# asp.net
[0, 9]
4,801,736
4,801,737
What is wrong with this foreach loop..??? Android
<p>I have a foreach loop iterating through each object in a vector. When I debug the code, it runs successfully for the first object in the vector. But then it will fail when it tries to run the loop for the second object. I am <em>sure</em> there is more than one element in the vector.</p> <pre><code>for(Object shape : vecForShapes) { currentNode = (Drawable) shape; newNode = getResources().getDrawable(R.drawable.nodered); newNode.setBounds(currentNode.getBounds()); vecForShapes.remove(currentNode); vecForShapes.add(newNode); } </code></pre> <p>So basically my question is, why is this loop failing? I really do not understand what is wrong here.</p> <p>P.S. My final aim is to remove <code>currentNode</code> from the vector, replace it with <code>newNode</code> then redraw the whole vector in my <code>onDraw</code> method.</p> <p>Thanks</p>
java android
[1, 4]
3,906,890
3,906,891
How to find and replace a substring?
<p>For example I have such a string, in which I must find and replace multiple substrings, all of which start with <code>#</code>, contains 6 symbols, end with <code>'</code> and should not contain <code>)</code> ... what do you think would be the best way of achieving that?</p> <p>Thanks!</p> <p>Edit: just one more thing I forgot, to make the replacement, I need that substring, i.e. it gets replaces by a string generated from the substring being replaced.</p>
java android
[1, 4]
2,850,137
2,850,138
Stack of activity from Activity stack
<p>There is a stack of activity i want to call the activity from that stack , My question is that is it possible to check from that stack and call that intent . When i press home button and again when i press the executable it should start the activity where i have left . Is it possible ? Any example related to the same would be great help </p> <p>Thnx in advance .</p>
java android
[1, 4]
4,163,435
4,163,436
Why doesn't my hide function work on a click
<pre><code>$(document).ready(function() { $('#promotion_profile_booking_description').keyup(function () { var left = 200 - $(this).val().length; if (left &lt; 0) { left = 0; } $('#counter').text('Characters left: ' + left); }); $('#counter').bind('click', function() { (this).hide(); }); }); </code></pre> <p>The previous code essentially inserts "Characters left: x", as a text counter. It works great. However hiding the element on a click is another story. Why isn't my hide function working? Do you see any obvious errors in my JS?</p>
javascript jquery
[3, 5]
2,057,476
2,057,477
How can i get inside parentheses value in a string
<p>How can i get inside parentheses value in a string. </p> <pre><code>String str= "United Arab Emirates Dirham (AED)"; </code></pre> <p>I need only AED text. Thanks</p>
java android
[1, 4]
338,885
338,886
how do i concatenate input values and convert them to an overall number?
<p>I have 4 buttons with values 1 - 4, I want to concatenate the button value each time a number is clicked and present this in <code>#result</code> but I'm getting confused by how this should be done. At the moment I have created an array and then pushed each value into the array as it is clicked then going onto convert this to a string which I will then convert to a number but I'm guessing this is the totally wrong approach, can anyone advise how I can achieve this?</p> <p>JavaScript</p> <pre><code>$(document).ready(function () { var arr = [], value; $('.num').on('click', function(e) { value = $(this).val(); arr.push(value); var test = parseInt(arr.toString()); console.log(test); $('#result').text(test); }); }); </code></pre> <p>HTML</p> <pre><code> &lt;form id="myForm"&gt; &lt;input type="text" id="result" /&gt; &lt;input type="button" class="num" value="1" /&gt; &lt;input type="button" class="num" value="2" /&gt; &lt;input type="button" class="num" value="3" /&gt; &lt;input type="button" class="num" value="4" /&gt; &lt;/form&gt; </code></pre> <p>JSBIN - <a href="http://jsbin.com/exuwuz/2/edit" rel="nofollow">http://jsbin.com/exuwuz/2/edit</a></p> <p>So basically hit 1 and #result will show 1 hit 2 and #result will show 12 etc etc?</p>
javascript jquery
[3, 5]
4,076,705
4,076,706
I need to implement a simple .fadeIn with javascript
<p>I am trying to implement, what I think would be a fairly simple fadeIn using javascript, but I just can not get it to work.</p> <p>Here is the code:</p> <pre><code>&lt;script&gt; function changeborder() { search.style.border = '1px solid #4F94CD'; } &lt;/script&gt; &lt;div align='center'&gt; &lt;div id='top'&gt; &lt;div style="width:982px;"&gt; &lt;div id="floatleft"&gt;&lt;a href="http://www.pearlsquirrel.com"&gt;&lt;img src="pearlsquirrel.jpg"/&gt;&lt;/a&gt;&lt;/div&gt; &lt;div id="floatleftsearch"&gt; &lt;div style="margin-top:14px; height:36px;"&gt;&lt;form action='searchmusic.php' method='GET' autocomplete="off"&gt;&lt;input type='text' name='search' id='search' class='search' value="Search..." onClick="changeborder(); searchresults.style.visibility = 'visible';" onfocus="if(this.value==this.defaultValue)this.value='';" onblur="if(this.value=='')this.value=this.defaultValue; this.style.border = '1px solid #5E5E5E'; hidediv();" onkeyup='searchmusic()'/&gt; </code></pre> <p>My goal is the get this piece to fadeIn</p> <pre><code>function changeborder() { search.style.border = '1px solid #4F94CD'; } </code></pre> <p>However, I have tried all that I know, which is not much about javascript, and can not figure this out. I think that this is fairly simple to do, but I need any help that I can get. Thanks!</p>
javascript jquery
[3, 5]
5,509,196
5,509,197
Preload a spritesheet using Jquery
<p>I am having a spritesheet now what i want to do is to preload the spritesheet images how can i get through it using javascript.Please help me out.</p>
javascript jquery
[3, 5]
2,192,151
2,192,152
Unable to get a new line using \n in Confirmation Box
<p>Below is my code </p> <pre><code>btnDelete.Attributes.Add("onclick", "{return ConfirmAction('You are about to Delete Order . Please Note \r\n 1. Order no longer can be retrieved \r\n 2. Changes to the order are not saved. \r\n Are you sure you wish to continue to Delete?')};"); </code></pre> <p>I would like the Confirmation box to display the message with Yes and Cancel button as below:</p> <p>You are about to Delete Order . Please Note:<br> 1.Order no longer can be retrieved<br> 2.Changes to the order are not saved<br> Are you sure you wish to continue to Delete?</p> <p>I tried "\n" , '\n' , and "\r\n" but still unable to insert lines. </p>
c# javascript
[0, 3]
5,307,554
5,307,555
how to set a specific date to be available? datepicker
<p>I have DB mysql with column <strong>date_in</strong> and <strong>date_out</strong></p> <p>how to set datepicker to show available only dates from database mysql. i have two inputs with datepicker</p> <pre><code>&lt;input type="text" name="check_in_date" id="check_in" /&gt; &lt;input type="text" name="chek_out_date" id="check_out" /&gt; </code></pre> <p>for example i have <strong>check_in_dates</strong> = 10-05-2012, 13-05-2012, ... , n. and they must be only available to pick through jQuery.datepicker.</p>
javascript jquery
[3, 5]
2,783,632
2,783,633
Loading local files via jQuery (part 2)
<p>Ok, <a href="http://stackoverflow.com/questions/7666852/loading-local-files-via-jquery">here</a> we discussed the essence of the problem: in some browsers like Chrome and Opera HttpRequests to local files is turned off by default.</p> <p>Now the question is: how to build such HTML+javascript viewer of HTML documents, that:<br> 1) would run locally on any (or most of) browser(s) without additional tuning;<br> 2) would not use frames;<br> 3) would have an ability to work with many different files(5-10k);<br></p> <p>Thanks,<br> SM</p>
javascript jquery
[3, 5]
4,498,656
4,498,657
client side validation error
<pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/HomeMaster.master" AutoEventWireup="true" CodeFile="HomePage.aspx.cs" Inherits="Default2" Title="Untitled Page" %&gt; &lt;asp:Content ID="Content1" ContentPlaceHolderID="cp1" Runat="Server"&gt; &lt;script language="javascript" type="text/javascript"&gt; function checkInput() { var uname = document.getElementById("txtUName").value; var pwd = document.getElementById("txtPWord").value; var counter=0; if(uname.length==0) counter++; if(pwd.length==0) counter++; if(counter &gt; 0) { document.getElementById("dvError").innerHTML = "user name or password can not be blank" ; // alert("blank field"); return false; } return true; } &lt;/script&gt; &lt;div id="dvError" style="height: 102px; color:Red; " &gt;&lt;/div&gt; **on button click::** &lt;asp:Button ID="btnSin" runat="server" Text="SignIn" OnClientClick="return checkInput()" onclick="btnSin_Click" /&gt; </code></pre> <p><em>then i got an error::</em> <strong>Microsoft JScript runtime error: Object required</strong></p>
c# javascript asp.net
[0, 3, 9]
4,018,785
4,018,786
jQuery click behaviour
<p>I'm developing a menu. This menu, will change the background image when you click on a link, as almost all menus do. If I click in one link from the menu, this link background will change the color.</p> <p>My <a href="http://en.wikipedia.org/wiki/JQuery" rel="nofollow">jQuery</a> script is:</p> <pre><code>$(function() { $('#menu ul li').click(function() { $('#menu ul li').removeClass("current_page_item"); $(this).addClass("current_page_item"); //return false; }); }); </code></pre> <p>Today, with the "return false" commented, when I click on the link under "#menu ul li" it changes the background open the new page and the background is reset. For sure, if I uncomment the <code>return false</code>, the background works fine but then I cannot open any links. So it looks like after that I open a new page, it resets the classes. How can I make it persistent?</p>
javascript jquery
[3, 5]
5,240,273
5,240,274
Disabled link button still submitting in asp.net webform
<p>I'm trying to disable a link button to prevent the user from submitting several times.</p> <p>I've seen many questions like this here on SO, most people suggest the following javascript:</p> <p><code>button.disabled = true</code> or <code>button.disabled = 'disabled'</code></p> <p>Which indeed disables the button (the button is greyed out), but the problem is that it's still clickable, and still submits!!</p> <p>Here is my stripped down code:</p> <p><code>function ValidateButton(button){<br> // some other code<br> button.disabled = true;<br> button.value = 'Processing...';<br> }</code></p> <p><code>&lt;asp:LinkButton Text="Submit" ID="btnSubmit" runat="server" onclick="btnSubmitRow_Click" OnClientClick="return ValidateButton(this);"/&gt;</code></p> <ol> <li>Why is the button still clickable, and submits after being disabled ?</li> <li>The button text is still "Submit" not "Processing...', why?</li> </ol>
javascript asp.net
[3, 9]
1,518,392
1,518,393
Javascript interrupt Page request
<p>I have a page that sends a request to the server. On the server we then send a synchronous request to a third party web API. Because of the call to the web API we never have complete control over how long our server side processing will take. So, what I would like to do is write a javascript function that will interrupt this page request and forward the user to an error page after so much time. So my javascript would look a little like this.</p> <pre><code>function onSubmit() { var oneMinute = (60 * 1000); setTimeout(function(){ window.location.replace("http://errorPage.html"); }, oneMinute); return true; } </code></pre> <p>The problem is that even when the timeout method is executed the page still waits for a response from the server before redirecting to the error page. Is there a way to interrupt the page request so that it doesn't wait until a response is received before redirecting to the error page?</p>
javascript jquery
[3, 5]
1,131,072
1,131,073
Uploading a large number of fonts and showing sample in drop-down list/input field search font highlight
<p>I am creating a text editor in the style of Microsoft Office 2010. Alike Microsoft Office, I would like to have a drop down list of all fonts in the following format:</p> <pre><code>&lt;li&gt;Arial&lt;/li&gt; &lt;li&gt;Arial Black&lt;/li&gt; &lt;li&gt;Arial Narrow&lt;/li&gt; </code></pre> <p>However, there are over 500 fonts submitted to Google Fonts and even uploading a fraction of them, implementing them into my list with a preview of the font will take hours upon hours of repetitive behavior.</p> <p>Is there a way, using the likes of Javascript/JQuery/PHP to speed up the process, search a directory on my site and each folder is turned into a new list item or whatnot?</p> <p>Google Fonts Directory: <a href="https://code.google.com/p/googlefontdirectory/" rel="nofollow">https://code.google.com/p/googlefontdirectory/</a></p> <p>Hopefully this is useful to mention at the moment; Next to the drop down button to show this list, there is an input field of which you can enter a font. I would like to show some form of highlighing if the user manually starts typing.</p> <p>Best Regards, Tim</p>
php javascript jquery
[2, 3, 5]
3,111,737
3,111,738
How can I extract a URL from url("http://www.example.com")?
<p>I need to get the URL of an element's background image with jQuery:</p> <pre><code>var foo = $('#id').css('background-image'); </code></pre> <p>This results in something like <code>url("http://www.example.com/image.gif")</code>. How can I get just the "http://www.example.com/image.gif" part from that? <code>typeof foo</code> says it's a string, but the <code>url()</code> part makes me think that JavaScript and/or jQuery has a special URL type and that I should be able to get the location with <code>foo.toString()</code>. That doesn't work though.</p>
javascript jquery
[3, 5]
1,233,705
1,233,706
How do I tie in my image handler with an image control?
<p>I've been looking around and reading about handlers, but I don't fully understand how to implement them for my situation.</p> <p>I want display a screenshot from the user's clipboard. I already have code that retrieves the image from the clipboard into a bitmap format. This is what I have:</p> <pre><code>var dataobj = new DataObject(); dataobj = (DataObject)Clipboard.GetDataObject(); System.Drawing.Image img = dataobj.GetData(DataFormats.Bitmap) as System.Drawing.Image; original = (System.Drawing.Image)img.Clone(); img = resizeImage(img, new Size(670, 500)); String s = "c:/Temp/temp.png"; img.Save(s, ImageFormat.Png); Image1.ImageUrl = s; Image1.DataBind(); </code></pre> <p>My problem was that I am not able to save the images to the hard disk.</p> <p>My first question is will an image handler help me in this situation?</p> <p>if it will, how do I modify that code and tie it into my image handler with this code:</p> <pre><code>public class getmyimage : IHttpHandler { public void ProcessRequest(HttpContext context) { HttpResponse r = context.Response; r.ContentType = "image/png"; // Write the requested image r.WriteFile("temp.png"); } public bool IsReusable { get { return false; } } } </code></pre>
c# asp.net
[0, 9]
4,796,810
4,796,811
Adding new query parameter to hyperlinks dynamically
<p>I have several hyperlinks in my homepage. I would like to add a query parameter at the end of each hyperlink dynamically.</p> <p>For example;</p> <pre><code>&lt;a href="detail.aspx?id=2" target="_blank" &gt;xyz&lt;/a&gt; &lt;a href="detail.aspx?cid=5" target="_blank" &gt;pqr&lt;/a&gt; </code></pre> <p>will be converted to</p> <pre><code>&lt;a href="detail.aspx?id=2&amp;redirectFrom=hp" target="_blank" &gt;xyz&lt;/a&gt; &lt;a href="detail.aspx?cid=5&amp;redirectFrom=hp" target="_blank" &gt;pqr&lt;/a&gt; </code></pre> <p>a new query parameter "<strong>redirectFrom</strong>" with value have been added to the converted hyperlinks.</p> <p>How I can achieve it using ASP.net C#?</p>
c# asp.net
[0, 9]
5,920,430
5,920,431
jquery fading in from full opacity to 0.2
<p>when the page loads i would like the span overlay to fade in from full #000 to opacity 0.2 and then stay at 0.2 to which when i hover it goes to opacity 0</p> <p>this is the code i have at the moment</p> <pre><code>$(function () { $('ul li a').append('&lt;span id="load"&gt;&lt;/span&gt;'); $('span').css('display', 'block').fadeOut(3400); $('span') .animate ({ "opacity" : .2 }); $('span') .hover(function() { $ (this) .animate ({"opacity": 0}); }, function () { $(this).stop() .animate ({"opacity": .2 }); }); }); </code></pre> <p>here is an example</p> <p><a href="http://satbulsara.com/experiment-04/" rel="nofollow">http://satbulsara.com/experiment-04/</a></p>
javascript jquery
[3, 5]
372,415
372,416
Use jQuery to reference other javascript
<p>Basically Im working with Sharepoint, help me god!</p> <p>Sharepoint does some crazy the things but Im hoping what I want to do can be achieved using jQuery.</p> <p>Sharepoint is writing some image values into a table:</p> <pre><code> &lt;script&gt; fNewItem = false; InsertItem("http://dev_site/sites/Pictures/Waves.jpg", "5", "BlueWaves", "jpg", "1920", "1080", "/_layouts/images/icjpg.gif", fNewItem); &lt;/script&gt; </code></pre> <p>There are a number of these output by Sharepoint, this snippet is from a Sharepoint Gallery so I'd need to loop through the page to find all of these so that I can grab all of the images. </p> <p>What I want to know is if there is anyway for me to grab these values using jQuery and then output them again?</p>
javascript jquery
[3, 5]
2,484,306
2,484,307
Access a JavaScript variable from PHP link
<p>I'm new to JavaScript and PHP. I need to get some variables from a PHP link into my JavaScript. I need to access <code>a1</code>, a text variable (<strong>Edit: string</strong>) as well as <code>a2</code> and <code>a3</code>, two <code>int</code> variables from <code>myfile.php</code>. Can anyone give me an example using three variables?</p>
php javascript
[2, 3]
4,835,308
4,835,309
Implementation of PHP profanity filter
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/273516/how-do-you-implement-a-good-profanity-filter">How do you implement a good profanity filter?</a> </p> </blockquote> <p>I have an iPhone app that passes a string through a URL to my php script, which then inserts to my database. I'd like to write some php code that reads $body for any pre-defined profanity.</p> <p>Right now, I only have the following code, but it only looks for exact matches, not if $body contains, then.. type of a sequence. Also, I need it to replace the swear with a blank " ", removing the word all together.</p> <pre><code>if($body == "swear word") return; </code></pre>
php iphone
[2, 8]
1,961,908
1,961,909
How to send dynamically value from javascript to hiddenfield
<p>I have a variable "place", which is changing dynamically (get diffrent values for some actions). Here JS code.</p> <pre><code>google.maps.event.addListener(autocomplete, 'place_changed', function () { var place = autocomplete.getPlace(); }); </code></pre> <p>How to get this variable to asp.net(C#) in code behind? </p>
c# javascript asp.net
[0, 3, 9]
3,566,022
3,566,023
Why doesnt keydown work?
<p>This simple code doesnt work! <a href="http://jsfiddle.net/FPcFn/" rel="nofollow">http://jsfiddle.net/FPcFn/</a></p> <pre><code>$(document).keydown(function(e){ switch (e.which){ case 37: alert("37"); } }); </code></pre> <p>Why? What could possibly go wrong?</p>
javascript jquery
[3, 5]
2,995,600
2,995,601
image loading in jquery
<p>I have a function in which in first draw the div's and call image load function</p> <p>In image load function i call a another function Loadimage</p> <p>In Loadimage i append the image to the div's which i have drawn in first funtion</p> <p>thumb[] has a image html tag</p> <p>I have button when clicked on it a popupwindow opens,and the popupwindow has div called image in which the images are appended</p> <pre><code>&lt;div id="image"&gt;&lt;/div&gt; </code></pre> <p>&nbsp;</p> <pre><code>for (var i in this.thumb) { var img = this.thumb[i]; var imgdiv = $('&lt;div&gt;'); imgdiv.attr('id', 'img' + i + ''); (#image).append(imgdiv); $(img).load({ navig_cell: img, index: i }, jQuery.proxy(this, 'Loadimage')); } Loadimage: function(params) { var img = params.data.navig_cell; var index = params.data.index; $('#img' + index + '').append(img); } </code></pre> <p>Once i close the popupwindow in which i append the image and for the next time when i quickly open the popupwindow the images are appending from the place were the loading of the image stop and also the same images are append for second time from the place the loading of the images stopped(2 time the images are appending) </p>
javascript jquery
[3, 5]
5,102,935
5,102,936
Loop through array and retrieve values
<p>I am trying to loop through an array and then loop through a list.</p> <p>The issue I am having is for each <code>&lt;li&gt;</code> the entire array is being appended, but what I need to happen is index(0) of array gets added to the 1st li, index(1) to the 2nd li and so on.</p> <p>Code: </p> <pre><code>// Create our test array. var arrValues = [ "one", "two", "three" ]; // Loop over each value in the array. $.each(arrValues,function( intIndex, objValue ){ $("#list span").each(function() { $(this).append(objValue); }); }); </code></pre> <p>current output: </p> <pre><code>&lt;ul id="list"&gt; &lt;li&gt;Content 1 here&lt;span&gt;onetwothree&lt;/span&gt;&lt;/li&gt; &lt;li&gt;Content 2 here&lt;span&gt;onetwothree&lt;/span&gt;&lt;/li&gt; &lt;li&gt;Content 3 here&lt;span&gt;onetwothree&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>required output: </p> <pre><code>&lt;ul id="list"&gt; &lt;li&gt;Content 1 here&lt;span&gt;one&lt;/span&gt;&lt;/li&gt; &lt;li&gt;Content 2 here&lt;span&gt;two&lt;/span&gt;&lt;/li&gt; &lt;li&gt;Content 3 here&lt;span&gt;three&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>Appreciate any help :)</p>
javascript jquery
[3, 5]
5,042,160
5,042,161
How to animate 6 boxes incrementally?
<p>Here is my html...</p> <pre><code> &lt;div class="project"&gt; &lt;div class="box"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="project"&gt; &lt;div class="box"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="project"&gt; &lt;div class="box"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="project"&gt; &lt;div class="box"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="project"&gt; &lt;div class="box"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="project"&gt; &lt;div class="box"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is my javascript...</p> <pre><code>$('.box').each(function(){ $(this).animate({ width: 300, height: 200, top: 0, left: 0 }, 500); }); </code></pre> <p>I want each box to animate in one after the other. I can do this specifically, but the code is really long with all the callbacks. Wondering how I can loop through them correctly?</p>
javascript jquery
[3, 5]
4,658,771
4,658,772
separate a string in c#
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1219094/separate-firstname-and-lastname-from-fullname-string-in-c">Separate firstname and lastname from fullname string in C#</a> </p> </blockquote> <p>I want to split a string which is like lastname, firstname. I only need the first name how to do that. How to split the string</p> <pre><code> for (int counter = 0; counter &lt; ListBoxMembers.Items.Count; counter++) { string FirstName = ListBoxMembers.Items[counter].Value; </code></pre> <p>It takes the whole string i just need firstname</p>
c# asp.net
[0, 9]
4,631,326
4,631,327
Jformer questions
<p>I am looking for some help with jFormer.</p> <p>The way my site works a form cannot submit to the same place it was built,</p> <p>yet looking at the demo code it seems that this is how it has to work?</p> <p>Is this true?</p>
php jquery
[2, 5]
4,811,189
4,811,190
how to modify the appearance of a checkboxlist to it look like buttons
<p>I thought it would be easy, but I'm not being able to find how to do it. I found how to do it with a checkbox (<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox.appearance.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.windows.forms.checkbox.appearance.aspx)</a>.</p> <p>But, how could do it with the checkboxlist control?</p>
c# asp.net
[0, 9]
2,302,292
2,302,293
Out of range exception of a dataset
<p>Hoping this is a simple one</p> <p>I am extracting the data from a column of my dataset. As the SQL query is supplied an ID only one result will ever be returned. So I would think this result would always be at row '0' of the dataset.</p> <p>If i click the first result in my datagrid........send the id '0' across to my second page which then extracts the image name from the DB it crashes. If I select the second result in the grid i.e '1' it is fine.</p> <p>Here is my code:</p> <pre><code> SqlConnection sqlcon = new SqlConnection(connstring); SqlCommand sqlcmd = new SqlCommand("select pic from cds WHERE _id = '" + passedID + "'", sqlcon); SqlDataAdapter adp = new SqlDataAdapter(sqlcmd); DataSet ds = new DataSet(); adp.Fill(ds); // Rows set to '0' for the first result in the dataset but crashes if the first item is selected. object a = ds.Tables[0].Rows[0]["pic"]; string test = a.ToString(); </code></pre>
c# asp.net
[0, 9]
1,722,851
1,722,852
Emulating click based event on a web page
<p>This link goes to an implementation of the imagination captcha <a href="http://goldbach.cse.psu.edu/s/captcha/">imagination</a></p> <p>The authors have themselves requested for people to make algorithms to try its efficiency against AI attacks.</p> <p>Essentially the first page is asking for a mouse click anywhere on the image... My problem is that my algorithm comes up with the point (x,y) on the image but I want to emulate it real time on this link...</p> <p>Can some one tell me how can i send the point values on this link and get back the message whether i was successful or not....</p> <p>Essentially I am asking how can i emulate a mouse click on this link at the points that my algorithm gives using C#...</p> <p>I am asking this only for studying the features of this captcha and its accuracy. </p> <p>Thanks a lot</p>
c# javascript
[0, 3]
3,377,476
3,377,477
jQuery match from value string
<p>I trying to match a variable from an url. This works fine if I use the expression directly in the match method. However I am having problem getting it to work if the expression is inside a string.</p> <blockquote> <p>var match = '/(page_art_list=\d+)/';</p> </blockquote> <p>match contains the value..</p> <pre><code>var pattern = "/("+paramName+"=\d+)/"; var match = this.href.match(pattern); </code></pre> <p>match is null</p> <p>I have double checked that both examples produce exactly the same string. </p> <p>Any thoughts?</p> <p>Best regards. Asbjørn Morell </p>
javascript jquery
[3, 5]
4,048,937
4,048,938
Selection row disable/reenable text selection
<p>I have this code which selects multiple row when shift key is pressed. But whenever selection starts, the table text always gets selected, hence I tried to add disableSelection( ); to the table and re-enable it once mouseup. However, it is not working, the text still get selected. Any help is greatly appreciated.</p> <pre><code>$(".tableGrid tr").live("click", function(event) { if( event.shiftKey ) { $(".tableGrid").disableSelection( ); } var tableRow = $(this).closest("tr").prevAll("tr").length + 1; if ($(this).hasClass("rowSelected")) { event.shiftKey ? $(this).removeClass("rowSelected") : $(".tableGrid tr").removeClass("rowSelected"); } else { if( !event.shiftKey ) { $(".tableGrid tr").removeClass("rowSelected"); } $(this).addClass("rowSelected"); } if( event.shiftKey ) { var start = Math.min(tableRow, lastSelected); var end = Math.max(tableRow, lastSelected); for( var i=start; i&lt;end; i++ ) { $(".tableGrid").find("tr").eq(i).addClass("rowSelected"); } } else { lastSelected = $(this).closest("tr").prevAll("tr").length + 1; } }).mouseup(function( ) { $(".tableGrid").enableSelection( ); }); </code></pre>
javascript jquery
[3, 5]
2,002,011
2,002,012
What is the difference between having a function in Jquery.Document and not having it in
<p>I am just wondering what is the difference between these two</p> <pre><code>File1.js $(function() { function MyFunction() { // some code here } }); File2.js $(function() { // call it. MyFunction(); }); </code></pre> <p><hr /></p> <pre><code>File1.js function MyFunction() { // some code here } File2.js $(function() { // call it. MyFunction(); }); </code></pre> <p>So what is the difference? When I did the first way and I tried to call MyFunction() from File2.js it never worked. I moved my function out of the Jquery.Document ready in File1.Js and it worked.</p> <p>I have some other functions that are in File1 and even though they are in document ready anything in File1 can seem to call it no problem.</p> <p>It just seems like across script files it has a problem calling functions when setup that way.</p>
javascript jquery
[3, 5]
869,864
869,865
Asp.Net program
<p>What does the following line of code do</p> <pre><code>SqlDataSource DataSource =(SqlDataSource)CreateUserWizardStep1. ContentTemplateContainer.FindControl("InsertExtraInfo"); </code></pre>
c# asp.net
[0, 9]
1,252,339
1,252,340
Android: PHP script to MS Access Database
<p>Is there a PHP script that could fetch data from MSAccess Database? because my database is MsAccess. Then android could view that data in that webservice.. As i know.. PHP script is mostly used in MySQL database. Fetch the data and output will be in JSON Format. The android could get the data by using http post. </p>
java php android
[1, 2, 4]
1,227,940
1,227,941
Retain the page update by Javascript and run the PHP code?
<p>In a php project I need to add items to database, list them &amp; allow the user to edit &amp; update items using a single page.</p> <p>This is my code to edit item link in HTML table</p> <pre><code>echo '&lt;a href=" '.$_SERVER['PHP_SELF'].'?name=edit&amp;id=' .$rowCountry-&gt;CountryId .' " id="edit" onClick="MyFunction()"&gt; Edit &lt;/a&gt;'; </code></pre> <p>When a user click on the above link I need to hide <code>Add</code> button and display two new buttons to <code>Update</code> &amp; <code>Cancel</code> the edit + display selected item name in a Text box to Edit. </p> <p>To hide and display buttons I'm using jQuery and to display the item name i need to use PHP. Here when i put PHP code and reload the page with <code>$_SERVER['PHP_SELF']</code> (as in above code), hiding &amp; displying of buttons is lost after the page load. (If I remove the <code>_SERVER['PHP_SELF']</code> code from link it hides and display buttons as expected (but no php code run))</p> <p>How can I retain the page update by Javascript and run the PHP code?</p> <p>I'm new to PHP am I missing something in my code?</p>
php javascript
[2, 3]
2,915,648
2,915,649
Use of break and continue in jQuery
<p>I know with core Javascript we can do things like this:</p> <pre><code>for(i=1;i&lt;10;i++){ if(i==5){ //break or continue } } </code></pre> <p>But why this is not correct ?</p> <pre><code>$.each(iteratorarray,function(i){ //iteratorarray - just an array if(i==5){ //break or continue,will cause error here } }); </code></pre>
javascript jquery
[3, 5]
2,089,671
2,089,672
get all cookies of my site
<p>how can i get all the cookies set by my site using js. I dont want to do say <strong>Cookie("username")</strong> but loop through all the cookies and get the key=value pairs of my site</p>
php javascript
[2, 3]
4,470,947
4,470,948
how to change jquery ui autocomplete function suitable for python
<p>Instead of using search.php within this example, how can i use a python method to return the data? example: is this valid: $.getJSON( "{{ data }}", { term: extractLast( request.term ) }, response );</p> <pre><code> $(function() { function split( val ) { return val.split( /,\s*/ ); } function extractLast( term ) { return split( term ).pop(); } $( "#birds" ) // don't navigate away from the field on tab when selecting an item .bind( "keydown", function( event ) { if ( event.keyCode === $.ui.keyCode.TAB &amp;&amp; $( this ).data( "autocomplete" ).menu.active ) { event.preventDefault(); } }) .autocomplete({ source: function( request, response ) { $.getJSON( "search.php", { term: extractLast( request.term ) }, response ); }, search: function() { // custom minLength var term = extractLast( this.value ); if ( term.length &lt; 2 ) { return false; } }, focus: function() { // prevent value inserted on focus return false; }, select: function( event, ui ) { var terms = split( this.value ); // remove the current input terms.pop(); // add the selected item terms.push( ui.item.value ); // add placeholder to get the comma-and-space at the end terms.push( "" ); this.value = terms.join( ", " ); return false; } }); }); </code></pre>
jquery python
[5, 7]
646,664
646,665
How to tell if string time-A is before time-B?
<p>if I have 4 variables</p> <p>startTime; endTime; startMerid; endMerid;</p> <p>startMarid and endMarid are either going to be 'AM' or 'PM'.</p> <p>but startTime and endTime are going to be strings like 'dd:dd'</p> <p>so it may be start:<code>12:30 PM</code> and end:<code>5:30 PM</code></p> <p>How can I validate that the end time is not before the start time?</p> <p>Thanks!!</p>
javascript jquery
[3, 5]
4,037,635
4,037,636
Clear <input> field from code behind
<p>To pass values from javascript to the code behind after a postback I use this code:</p> <pre><code>string strRowNumberTblOne = Request.Form["iRowNumberTblOne"]; &lt;input type="hidden" id="iRowNumberTblOne" name="iRowNumberTblOne" value="" /&gt; </code></pre> <p>Is there a way to clear the input field from the code behind? The Request.Form is read only. </p>
c# asp.net
[0, 9]
1,425,649
1,425,650
Why this is not Working in Javascript
<pre><code>....... ........ key1 = 'start' + i + ''; key2 = 'end' + i + ''; datePass.push({ key1: start, key2: end }); </code></pre> <p>it returns </p> <pre><code>[{key1 : `somevalue`, key1: 'somevalue'}] </code></pre> <p>but i want </p> <pre><code>[{start1 : `somevalue`, end1: 'somevalue'}] </code></pre> <p>and so on.</p> <p>How can i do so. pleas help.</p>
javascript jquery
[3, 5]
1,901,125
1,901,126
How to improve performance..?
<pre><code>function removeTds() { var elements = $('#goldBarList tr:not(:eq(0))').filter(':has(:checkbox:checked):lt(50)'); var count = elements.length; elements.each(function() { grossWeightTotal = grossWeightTotal - $('#goldBarList tr:eq(' + $(this).index() + ') td:eq(8)').text(); netWeightTotal = netWeightTotal - $('#goldBarList tr:eq(' + $(this).index() + ') td:eq(9)').text(); fineOunceTotal = fineOunceTotal - $('#goldBarList tr:eq(' + $(this).index() + ') td:eq(10)').text(); }); elements.remove(); if(count === 50) window.setTimeout(removeTds, 1); } removeTds(); </code></pre> <p>The above code results in the "stop running this script?" prompt. I have 4000 records.</p>
javascript jquery
[3, 5]
4,560,174
4,560,175
Accessing Java Privileged Actions from within Rhino script
<p>How can I execute a local file from JavaScript running within Rhino in Java? I will consider any method that works from within the Rhino environment. My current exploration of the issue is below.</p> <p>I am attempting this through java.lang.Runtime.exec, with help from the Mozilla "Scripting Java" tutorial i can access it. However this is a restricted action so calling it directly gives an access control exception.</p> <p>To solve this I need to use the AccesController.doPrivileged method. An example of using this in Java is below;</p> <pre><code>AccessController.doPrivileged(new PrivilegedAction() { public Object run() { // Code goes here. Any permission checks within this // run method will require that the intersection of the // callers protection domain and the snapshot's // context have the desired permission. } </code></pre> <p>The road block is replicating the construction of a PrivilegedAction in javascript. </p> <pre><code>var ourRuntime = Packages.java.lang.Runtime.getRuntime(); //ourRuntime.exec("notepad.exe") //will raise Access Control Exception var controller = Packages.java.security.AccessController.doPrivileged var action = new Packages.java.security.PrivilegedAction(ourRuntime.exec("notepad.exe")) // somehow make this wwrk controller.doPrivileged(action) </code></pre> <p><a href="http://www.mozilla.org/rhino/ScriptingJava.html" rel="nofollow">Mozilla Scripting Java</a></p> <p><a href="http://docs.oracle.com/javase/1.4.2/docs/api/java/security/AccessController.html" rel="nofollow">java.securit.AccessController</a></p>
java javascript
[1, 3]
4,118,083
4,118,084
How to get country name from time of android mobile?
<p>Hi I am very new to Android Development. I want to pick the country name based on the current time of the particular mobile, while clicking the button. How can i do it? Any body tell me? Thanks in advance.</p>
java php android
[1, 2, 4]
3,507,291
3,507,292
In the following code is it possible to convert long datatype into string datatype?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/5071040/java-convert-number-to-string">Java - Convert number to string</a> </p> </blockquote> <pre><code>private String getHome() { String defaultHome = Environment.getExternalStorageDirectory().getAbsolutePath(); File f = new File("/sdcard/download"); File[] files = f.listFiles(); for(int i=0; i &lt; files.length; i++) { File file = files[i]; //take the file name only long size = file.length()/1024; String path = file.getPath().substring(file.getPath().lastIndexOf("/")+1,file.getPath().length()).toLowerCase(); String newString = size.toString(); //String path = getSharedPreferences(PREF_TAG, 0).getString(PREF_HOME,defaultHome); //if (path.length()&gt;1 &amp;&amp; path.endsWith("/")) { // path = path.substring(0,path.length()-2); //} //File pathFile = new File(path); if (file.exists() &amp;&amp; file.isDirectory()) return path+size; else return defaultHome+size; } return defaultHome; } </code></pre>
java android
[1, 4]
4,216,727
4,216,728
Android, extract javascript variable from webview using javascript interface
<p>How can I extract this variable bellow from a website to my android code? I guess it should work using javascript interface but how do I get it?</p> <pre><code>&lt;script type="text/javascript"&gt; var Ids = "[4161, 104, 121, 202, 1462]"; &lt;/script&gt; </code></pre> <p>And I can't change the code on the website to a method that returns the value.</p> <p>Any suggestions?</p>
javascript android
[3, 4]
3,234,855
3,234,856
Match a table cell class and index using jQuery
<p>The following code is just a demonstration for the theory that I want to apply to my app so using THIS instead of td.flex is not appropriate for the the second line in the function.</p> <p>Also I MUST Use .index instead of nth-child for other reasons.</p> <p>That all said :)</p> <p>The following function loops through all the TD's in the first row of a table that have a class of flex. For each of these record the index value. The next line is not part of the real application but to test the theory should find all the tds with a class of flex that have an index value that matches the cellIndex value. Any ideas how to get this to work?</p> <p><strong>Remember this code is to test the theory hence why I am not using nth-child or this to apply the css colouring!</strong></p> <pre><code>cellIndex = new Array(); $('table tr:first-child td.flex').each(function (i) { cellIndex[i] = $(this).index(); $($('td.flex').index(cellIndex)).css('background-color', '#ff0000'); }); </code></pre> <p>if I do: <code>console.log($('td.flex').index(cellIndex));</code></p> <p>I get <code>-1</code> for each loop</p> <p><strong>Just to confirm I know I could do this:</strong></p> <pre><code>$(this).css('background-color', '#ff0000'); </code></pre> <p>but this <strong>IS NOT</strong> what I'm trying to achieve with this function and would NOT work in the real application.</p> <p>HTML example:</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td class="flex"&gt;Flex&lt;/td&gt; &lt;td&gt;Not Flex&lt;/td&gt; &lt;td class="flex"&gt;Flex&lt;/td&gt; &lt;td&gt;Not Flex&lt;/td&gt; &lt;td&gt;Not Flex&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre>
javascript jquery
[3, 5]
2,171,550
2,171,551
Is regular Java the same as the Java for Android
<p>Is regular Java the same as the Java for Android?</p> <p>If yes - from where can I download a good java reference?</p> <p>Looking for something like: <code>Command | small sample | short Explanation</code></p>
java android
[1, 4]
2,173,456
2,173,457
Search & Replace Whole HTML Strings with jQuery
<p>I'm having some trouble searching &amp; replacing an entire string of HTML. </p> <p>My example in this fiddle is me trying to replace an entire div tag with all of its classes &amp; markup:</p> <p><a href="http://jsfiddle.net/LqkNE/" rel="nofollow">http://jsfiddle.net/LqkNE/</a></p> <p>As you can see, there are two little issues-- one with an ampersand that's causing me problems too.</p> <p>Can someone help me out with what I'm doing wrong?</p>
javascript jquery
[3, 5]
1,850,813
1,850,814
PHP's 'gzuncompress' function in C#?
<p>PHP's 'gzuncompress' function in C#? Is there a function similar to PHPs gzuncompress in C#? </p>
c# php
[0, 2]
2,056,323
2,056,324
Sliding up DIV container
<p>How to make a sliding up horizontal DIV container using jquery? So far I have the below-provided code. The problem is that the content of <code>&lt;h1 id="filter_content"&gt;Content&lt;/h1&gt;</code> is initially not hidden. Also I've seen very nice looking sliding up menus, something like the first screenshot <a href="http://www.zabbix.com/screenshots.php" rel="nofollow">here</a>. So, when user clicks on +, the content slides up. Where can I actually find a sample code or some example?</p> <pre><code>&lt;div id="filter"&gt; &lt;h1&gt;Filter&lt;/h1&gt;&lt;br&gt; &lt;/div&gt; &lt;h1 id="filter_content"&gt;Content&lt;/h1&gt; &lt;script&gt; $('#filter').click(function() { if ($("#filter").is(":hidden")) { $("#filter_content").show("slow"); } else { $("#filter_content").slideUp("slow"); } }); &lt;/script&gt; </code></pre>
php javascript jquery
[2, 3, 5]
540,614
540,615
jquery validation for specific button onclick
<p>i am using jquery client side validation in asp.net.</p> <p>the problem i am facing now is that whenever i click any button in a page it causes validation rather than for specific button alone.</p> <p>how to resolve this .?</p> <p>thank you</p>
asp.net jquery
[9, 5]
2,746,556
2,746,557
jquery slide show plugin like this
<p>please see that site: <a href="http://www.top-pcb.com/" rel="nofollow">link</a> and watch the slideshow.</p> <p>How can I create a slideshow like that with jQuery? (is there plugin?)</p> <p>thanks ..</p>
javascript jquery
[3, 5]
4,441,348
4,441,349
How to set :hover on a li(A) when hover an other li(B)
<p>I am daily an iOS developer, but i'm trying to give a help for a friend in php and jquery, since I didn't do Jquery for a lonnng time, im asking you guys a little help :)</p> <p>So let's say I got this, for a unique ID</p> <blockquote> <p>&lt; li class="listname" value="'.$id.'"></p> </blockquote> <p>When I go hover this, I want to li:hover this for the same unique ID</p> <blockquote> <p>&lt; li class="listpicture" value="'.$id.'></p> </blockquote> <p>My CSS job is done, when I go hover one, it does the job.</p> <p>I began my script with something like that</p> <pre><code>$("li.listname").mouseover( function() { var id = $("li.listpicture").attr('value'); // and miss some job here } </code></pre> <p>I feel a little bit noob on this, but I will feel free to help you with iOS Developement :)</p> <p>Thx</p>
php javascript jquery
[2, 3, 5]
3,169,608
3,169,609
Disabling browser scrollbar
<p>Hi Is it possible to disable browser scroll bar through java script...? If yes how?</p> <p>Help me if anybody knows it... Thanks in advance..</p>
javascript jquery
[3, 5]