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
4,825,936
4,825,937
Trying to use Jquery/javascript to calculate form fields
<p>Im having a terrible time trying to calculate the value of two form fields. I'm constantly getting "NAN" which would indicate non-numeric input, this is despite the fact that the form fields are only populated with numbers.</p> <p>In response I tried to use ParseInt to get a numeric value. This also fails to yield a successful result.</p> <p>This is what I have so far. Any help is appreciated.</p> <pre><code>$('#value-calc input').change(function () { var valueINT = parseInt($('#value'),10); var quantINT = parseInt($('#quantity'), 10); var math = ((valueINT/quantINT)*1000); $('#cpm').val(math); }); </code></pre> <p><a href="http://jsfiddle.net/greyoxide/YRWAA/1/" rel="nofollow">http://jsfiddle.net/greyoxide/YRWAA/1/</a></p>
javascript jquery
[3, 5]
600,528
600,529
Value of hidden input returns blank when it clearly isn't
<p>Why can't I get the value from this input? See the image below:</p> <p><img src="http://i.stack.imgur.com/y5oEu.jpg" alt="enter image description here"></p>
javascript jquery
[3, 5]
2,655,441
2,655,442
JavaScript opening new window instead of tab when command run too early
<p>I realize that you cannot control whether a browser opens a new <em>window</em> vs. a new <em>tab</em>, so this may have no solution.</p> <p>The problem is basically that I run something like:</p> <pre><code>function runCommand() { //... window.open(url); } </code></pre> <p>This runs from time to time if the user presses a special key or clicks. That all works fine, and it will open a new window or tab based on the user's browser settings. Great.</p> <p>The problem is, I also have some code:</p> <pre><code>if (x.property) runCommand(); </code></pre> <p>This will <em>always</em> open a the url in a new <em>window</em>, even though if you use <code>runCommand</code> at some other time on the same page, it will use a tab if that's the user's setting.</p> <p>At first, I thought that it may have had to do with the page not being fully loaded, so I both tried wrapping it in <code>document.ready</code> and also using <code>setTimeout()</code> to some high number (like 5 seconds). Even after doing that, <code>runCommand()</code> will <em>still</em> open a new window on the initial run even though it opens a new tab later on. Has anyone experienced this behavior or know how to fix it?</p> <p><strong>EDIT</strong>: I created a fiddle that showcases the problem. Please excuse the popup: <a href="http://jsfiddle.net/csPGU/" rel="nofollow">http://jsfiddle.net/csPGU/</a></p>
javascript jquery
[3, 5]
2,052,460
2,052,461
Why does the jQuery website use version 1.4.2 of its library?
<p>I've looked through the jQuery forums and not found anything about this. So I was wondering, if the jQuery framework is improving all the time (and up to version 1.7.1 at time of writing), then why doesn't the jQuery website itself use the latest verison?</p> <p>I expect the answer may be something like "because it doesn't need the latest features" or "if it ain't broke don't fix it", but I would have thought they would be championing their own latest work.</p> <p>Could anybody shed some light on this? I feel the real answer might be useful to other people with jQuery driven websites that have considered or are considering upgrading.</p>
javascript jquery
[3, 5]
3,397,918
3,397,919
Append text to iFrame body where users mouse is "blinking"
<p>I need to append a face icon to the body of a iframe. The problem I am having is that it is put at the end of the body, not where the user has the insertion point.</p> <p>Here is the code I have so far,</p> <pre><code> &lt;iframe style=""name="content" id="content" width="758" height="200" onload="javascript:load();"&gt;&lt;/iframe&gt; function angleFace() { $("#content").contents().find("body").append('&lt;img title="Angle" src="/media/angle.png" alt="Angle"&gt;'); } </code></pre> <p>I want the face to be put wherever the users insertion point is at. Right now the face is being put at the end of the document.</p> <p>Side note - You type into the iFrame then on the submit it is transfered to the textarea then entered into the database.</p>
javascript jquery
[3, 5]
690,485
690,486
FileUpload in C# with PHP Server
<p>I am currently working on a fileUploader in the C# language for a image hosting site I develop for, I am currently wondering what the best approach is to uploading files to the server(all php/sql) with the client software being C#.</p> <p>Also, how would I process these uploads in a PHP script, would you say something along the lines of:</p> <pre><code>upload.php?appfile=filepath? </code></pre> <p>Thanks,</p>
c# php
[0, 2]
2,606,687
2,606,688
Stop User Leaving Before Postback (Javascript/ASP.NET)
<p>I have several functions running on a postback that can take a little time to complete.</p> <p>When postback is initiated I show a loading image with this code:</p> <pre><code>function showLoader() { document.getElementById("&lt;%=loadingImage.ClientID%&gt;").style.visibility="visible"; } </code></pre> <p>I want to be able to add code to this function so if user tries to leave at this point they are informed the operation is not complete.</p> <p>I found this code:</p> <pre><code>function goodbye(e) { if(!e) e = window.event; //e.cancelBubble is supported by IE - this will kill the bubbling process. e.cancelBubble = true; e.returnValue = 'You sure you want to leave?'; //This is displayed on the dialog //e.stopPropagation works in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } } window.onbeforeunload=goodbye; </code></pre> <p>This works but I only want the code to be active when the loading image is active.</p> <p>I tried the following but it shows the alert message when the page eventually posts back:</p> <pre><code>function goodbye(e) { if(!e) e = window.event; //e.cancelBubble is supported by IE - this will kill the bubbling process. e.cancelBubble = true; e.returnValue = 'You sure you want to leave?'; //This is displayed on the dialog //e.stopPropagation works in Firefox. if (e.stopPropagation) { e.stopPropagation(); e.preventDefault(); } } function showLoader() { document.getElementById("&lt;%=loadingImage.ClientID%&gt;").style.visibility="visible"; window.onbeforeunload=goodbye; } </code></pre> <p>Any ideas how I can tweak this to just show when user leaves page and not when postback completes? </p>
javascript asp.net
[3, 9]
2,310,135
2,310,136
JavaScript innerchild?
<p>I have the following example HTML:</p> <pre><code>&lt;div id="target"&gt; &lt;div id="targetText"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>and I'm using the following code to get the inner div:</p> <pre><code>$('#targetText'); </code></pre> <p>instead, I was wondering if I could drop the id of the inner element, and somehow match the #target's child?</p> <p>I have like hundreds of inner children, so, it does not make sense to put an id to each of them. I could just do something like $("#target").innerChild(5); or something. Does anyone know a good way of doing this?</p>
javascript jquery
[3, 5]
48,650
48,651
How to get the duration of call started from your app?
<p>In my app, when someone clicks on a button, a phone call is started. Can i detect when the phone call is finished, so i will be able to measure the duration of this call?</p> <p>Tnx.</p>
java android
[1, 4]
1,409,184
1,409,185
Sending SMS via Android Application without moving to Message Box Default Application
<p>I want to ask you: 1-How can I send SMS via my applicatin without moving the user to the Messages box i just want to allow user to insert the text then he/she clicks on the send button after that directly the text message should be sent to specific number that i write in the code?</p> <p>I used this Code as shown below, it works well, but it moved me to the message box :( any Suggestions ?</p> <pre><code>MyButton.setOnClickListener(new View.OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub String str= MyEditText.getText().toString(); // For SMS Uri smsUri = Uri.parse("I wrote my number here"); Intent intent = new Intent(Intent.ACTION_VIEW, smsUri); intent.putExtra("sms_body", "Besm Allah"); intent.setType("vnd.android-dir/mms-sms"); startActivity(intent); } }); </code></pre> <p>====================== After Updating ================================</p> <p><img src="http://i.stack.imgur.com/PUpae.jpg" alt="Why (SmsManger) word appears like this (with lines)"></p>
java android
[1, 4]
4,433,401
4,433,402
Does Integer.valueOf() in java translate to int.Parse() in C#?
<p>I am trying to learn java from a C# background! I have found some nuances during my journey like C# doesn't have an Integer as reference type it only has int as a primitive type; this lead me to a doubt if this translation would be correct! </p> <pre><code> String line ="Numeric string";//Java string line = "Numeric string";//C# int size; size = Integer.valueOf(line, 16).intValue(); //In Java size = int.Parse(line,System.Globalization.NumberStyles.Integer);//In C# </code></pre>
c# java
[0, 1]
1,565,794
1,565,795
Using JavaScript to "Create" a Microsoft Word Document
<p>I would like to dynamically create a document using JavaScript and then open that document in Microsoft word. Is this possible? Here is my current code:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="js/jquery-1.4.4.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="myDiv"&gt;The quick brown fox jumped lazly over the dead log.&lt;/div&gt; &lt;script type="text/jscript"&gt; var printWindow = window.open("", "Print", "width=800,height=400,scrollbar=0"); var printAreaHtml = $("#myDiv").attr("outerHTML"); printWindow.document.open("text/html", "replace"); printWindow.document.writeln("&lt;html&gt;&lt;head&gt;") printWindow.document.writeln("&lt;meta HTTP-EQUIV='Content-Type' content='application/vnd.ms-word'&gt;"); printWindow.document.writeln("&lt;meta HTTP-EQUIV='Content-Disposition' content='attachment;filename=print.doc'&gt;"); printWindow.document.writeln("&lt;/head&gt;"); printWindow.document.writeln("&lt;body&gt;"); printWindow.document.write(printAreaHtml); printWindow.document.writeln("&lt;/body&gt;"); printWindow.document.writeln("&lt;/html&gt;"); printWindow.document.close(); </code></pre> <p>// printWindow.print(); </p> <p></p> <p> </p>
javascript jquery
[3, 5]
5,029,294
5,029,295
getting a clicked elements id with jquery
<p>I have a series of Delete icons displays as such:</p> <pre><code>echo '&lt;img id="'.$items['id'].'" src="images/delete.png" /&gt;'; </code></pre> <p>Where <code>$items['id']</code> is a reference to the id of the DB item I would like that icon to delete.</p> <p>How can I access this id in jquery when the item is clicked so I can then call a:</p> <pre><code>$.get('ajax/delete.php', { id: $('#id').val() }, function(data) {} </code></pre> <p>Or something of the sort.</p>
javascript jquery
[3, 5]
2,806,500
2,806,501
How does jQuery store xml used as a context parameter as it modifies it?
<p>I'm trying to reduce DOM manipulation during my javascript execution, and I thought about lazy-writing DOM elements, versus writing a large section of the DOM hidden and unhiding the needed parts later.</p> <p>To do this, I've separated out all my DOM content into a JSP which I load into a variable via ajax and manipulate with jQuery. However, if jQuery is doing this manipulation in a hidden div on the DOM, I've achieved no performance gain. Help?</p>
javascript jquery
[3, 5]
1,075,020
1,075,021
How do I tell IE to add the class 'Selected' to my LI on scroll?
<p>I was hoping to get a little help with my code. This works in moz/webkit but not in ie. I don't quite understand why :(</p> <pre><code>$(window).trigger('hashchange'); // Add .selected class to nav on page scroll var $sections = $('section'); var $navs = $('nav &gt; ul &gt; li'); var topsArray = $sections.map(function() { return $(this).position().top - 50; }).get(); var len = topsArray.length; var currentIndex = 0; var getCurrent = function( top ) { for( var i = 0; i &lt; len; i++ ) { if( top &gt; topsArray[i] &amp;&amp; topsArray[i+1] &amp;&amp; top &lt; topsArray[i+1] ) { return i; } } }; $(document).scroll(function(e) { var scrollTop = $(this).scrollTop(); var secondSection = topsArray[1]; if(scrollTop &lt;= 200) { // moved past the header $navs.eq(0).removeClass("selected") } else if(scrollTop &gt;= 205 &amp;&amp; scrollTop &lt;= secondSection ) { // between header and 2nd section $navs.eq(0).addClass("selected") } var checkIndex = getCurrent( scrollTop ); if( checkIndex !== currentIndex ) { currentIndex = checkIndex; $navs.eq( currentIndex ).addClass("selected").siblings(".selected").removeClass("selected"); } }); </code></pre>
javascript jquery
[3, 5]
4,840,927
4,840,928
Toggling checkbox only checks, doesn't uncheck
<p>I am trying to toggle some checkboxes using jQuery and I am using code that is recommended often when searching for toggling checkboxes, but it only seems to check them instead of toggling.</p> <p>Here's a jsfiddle for it:</p> <p><a href="http://jsfiddle.net/wgHpG/" rel="nofollow">http://jsfiddle.net/wgHpG/</a></p> <p>The HTML:</p> <pre><code>&lt;button id="priority-categories" class="btn"&gt;Priority&lt;/button&gt; &lt;input type="checkbox" name="category" value="1" id="1"&gt; &lt;input type="checkbox" name="category" value="2" id="2"&gt; &lt;input type="checkbox" name="category" value="3" id="3"&gt;​ </code></pre> <p>The js:</p> <pre><code>$('#priority-categories').click(function(){ var categories = [1, 3]; $.each(categories, function(key, value) { $('#' + value).prop('checked', !$('#' + value).checked); }); }); </code></pre>
javascript jquery
[3, 5]
5,397,314
5,397,315
Best way to store a key=>value array in Javascript?
<p>What's the best way to store a key=>value array in javascript, and how can that be looped through?</p> <p>The key of each element should be a tag, such as <code>{id}</code> or just <code>id</code> and the value should be the numerical value of the id.</p> <p>It should either be the element of an existing javascript class, or be a global variable which could easily be referenced through the class.</p> <p>Jquery can be used</p>
javascript jquery
[3, 5]
1,165,909
1,165,910
Button Submit calls Onload first!
<p>I have a problem with a webform. </p> <p><strong>My Goal:</strong> Intially when a page is loading, it has to load every textbox empty. After filling the info and click submit, it has to get submitted(UpdatePaymentInfo())</p> <p><strong>Problem:</strong> Here, When the user fills the info and clicks Submit,it calls onload function even before the submit button and makes all text box empty.</p> <p>Here is the code:</p> <pre><code>protected override void OnLoad(EventArgs e) { base.OnLoad(e); string QueryStringupdatecreditcard1 = Request.QueryString.ToString(); if (String.Equals(QueryStringupdatecreditcard1, "tabID=B")) { divTitle.Visible = false; trmain.Visible = false; tdOrderSummary.Visible = false; trCCandBilling.Visible = true; trtest2.Visible = false; divUpdatecreditcard.Visible = true; trusecompaddress.Visible = false; txtFirstName.Text = ""; txtLastName.Text = ""; txtAddress1.Text = ""; txtAddress2.Text = ""; txtCity.Text = ""; txtZip.Text = ""; txtCardNo.Text = ""; txtVccNumber.Text = ""; trAmountCharged.Visible = false; } } protected void imgbtnSubmit_Click(object sender, ImageClickEventArgs e) { try { UpdatePaymentInfo(); } } </code></pre>
c# asp.net
[0, 9]
2,940,522
2,940,523
Using jQuery to find push all links in html to an array?
<p>given a block of html that is a var, not on the actual document:</p> <pre><code>var html_cmt = "Check out this awesome link: https://github.com/jquery/jquery-ui Check out this awesome link: https://github.com/jquery/jquery-ui Check out this awesome link: https://github.com/jquery/jquery-ui Check out this awesome link:" </code></pre> <p>I need to build an array of all links, I have the following but it's only building the first one, not all.</p> <pre><code>var hrefs = new Array(); hrefs.push( $("&lt;div&gt;").html(html_cmt).find('a').attr('href')); </code></pre> <p>Suggestions on how I can create an array of all the links, given html content that is not on the document just a JS var? thank you</p>
javascript jquery
[3, 5]
1,166,748
1,166,749
jquery / javascript - listen for change in window orientation mode on mobile devices
<p>I'm wondering if there's some sort of cross-device method of listening for orientation mode changes on mobile devices with jquery / javascript?</p>
javascript jquery
[3, 5]
3,109,703
3,109,704
Android Screen Orientation
<p>I am using both landscape and portrait for an application. </p> <p>My problem is,whenever i rotate the screen,the TTS I am using in my application automatically </p> <p>starts from first.</p> <pre><code>How do I solve this problem? </code></pre>
java android
[1, 4]
5,448,708
5,448,709
JavaScript replace <br> with \n
<p>I have just stored a paragraph of text in a MySQL database using JavaScript and PHP and replaced <code>\n</code> with <code>&lt;br /&gt;</code>, the problem I'm now having is when I try and retrieve the text using PHP it prints it out as; <code>&lt;br /&gt;</code></p> <pre><code>Dear Sir/Maddam&lt;br /&gt;This is a letter concerning the following;&lt;br /&gt;I would like to.... </code></pre>
php javascript jquery
[2, 3, 5]
3,840,273
3,840,274
How to show Image In GridView?
<p>I am working on a live project in which I have to prepare an Admin interface. In this Admin Interface the Admin of the website can manipulate data and user images. Problem is that I am unable to show the image because I have saved image path in database in respect to associate userid. I am also able to show data but I don't know how to show data so that the Admin can make changes upon it.</p>
c# asp.net
[0, 9]
2,731,691
2,731,692
How to trigger a js function with Jquery
<p>I want to trigger this jquery function by using trigger method of JQuery. How can I do that ? Actually I dont even know the trigger method is suitable for user defined functions. </p> <pre><code>$('a.pop').click(function() {alert('testing'); } </code></pre> <p><strong>this is not working</strong></p> <pre><code> $('a').trigger(testtt); var testtt = function(){ alert('aaa');} </code></pre>
javascript jquery
[3, 5]
1,894,331
1,894,332
Getting value from Object using Jquery
<p>I am new bee of Jquery. I am facing a problem while getting value from object.</p> <p>Here is snippet that set the values and return of object.</p> <pre><code>expItem1 = new sap.ui.core.ListItem( { text : "Hello", key : "World" }); </code></pre> <p>So, when i want to get values of key from <strong>expItem</strong> object, So, Whenever i get value from object it says me invalid property.</p> <pre><code>alert(expItem1.text) </code></pre> <p>Any suggestion</p>
javascript jquery
[3, 5]
4,218,591
4,218,592
How to get html source code from external url
<p>How can I get html source code from an external web page? </p> <p>Something like: <code>getHtml('http://google.com');</code>.</p> <p>I've tried to get content of iframe using: <code>$("#frame").contents().find("html");</code>, but if in my case the webpage doesn't have html tags, just 1 line of text. I can't do it with php <code>file_get_contents()</code> because it doesn't keep session data.</p>
javascript jquery
[3, 5]
1,795,767
1,795,768
How to not check a checkbox when touch
<p>I have a checkbox that is switching state on touch. I am wanting to find out how to ignore the state switch on touch. I have an onClickListener attached to the checkbox and inside of that I am changing the state with "Yes" or "No" buttons.</p> <pre><code> if(sog.isChecked()){ sog.setChecked(false); } else { sog.setChecked(true); } </code></pre> <p>Edit: The checkbox is switching when touched and my yes button is also changing state.</p> <p>Edit 2: I want my dialog to change the state rather than the checkbox doing it on it's own.</p> <p>Edit 3:</p> <pre><code> sog.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { showDialog(3); } }); builder.setTitle("Checkbox") .setMessage( "Are you sure you want to switch checkbox?") .setPositiveButton("Yes", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { if(sog.isChecked()){ sog.setChecked(false); } else { sog.setChecked(true); setTotalTime(); } } }) .setNegativeButton("No", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); AlertDialog alert = builder.create(); return alert; </code></pre>
java android
[1, 4]
5,181,522
5,181,523
Is there a way to use Java and PHP on the same Apache server or at least, same port?
<p>I am pretty new to Java for Web and my question is if I can use Java and PHP together? I know I can use them together, let's rephrase the question, is there a way to access them at the same port?</p> <p>Java uses Tomcat, can PHP use tomcat also? </p>
java php
[1, 2]
561,914
561,915
Trigger email on specific date
<p>I have C# web application that I want it to send out an email on a certain date, such as if equipment isn't returned on the day it was due. Data is in MS SQL database.</p> <p>I've got all the email code already done, and I'm just curious how do I trigger this email, say after the COB on that particular day?</p> <p>Thanks,</p> <p>Eric</p>
c# asp.net
[0, 9]
4,045,151
4,045,152
Is there a way to export the content in DIV to a image programmatically?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/60455/take-a-screenshot-of-a-webpage-with-javascript">Take a screenshot of a webpage with javascript?</a> </p> </blockquote> <p>I hope to export the content in DIV to a image programmatically? How can I do? which code can do that ,server code or client code? Thanks! </p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;div id="a"&gt; Content to export to image &lt;/div&gt; &lt;div id="b"&gt; Normal text &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript asp.net
[3, 9]
5,514,282
5,514,283
The simplest solution to hide calendar on blur or click
<p><a href="http://jsfiddle.net/SXrAb/" rel="nofollow">http://jsfiddle.net/SXrAb/</a></p> <p>Following the jsfiddle link there is a simplified sample of what I need. Currently it shows the calendar on button click, and hides it on input blur.</p> <p>What I cannot implement additionally is hiding calendar on button click.</p> <p>So - calendar should:</p> <ol> <li><strike>open on button click if hidden</strike> (done)</li> <li><strike>hide on blur</strike> (done)</li> <li>hide on button click if opened (this is what I'm in stuck with, because blur is triggered before button click event so I have no chance to handle it properly)</li> </ol> <p><strong>UPD</strong>:</p> <p>the solution is expected to work correctly in all cases, like "mousedown on button, drag below, mouseup" (otherwise I wouldn't ask it ;-)</p>
javascript jquery
[3, 5]
5,029,742
5,029,743
Question regarding execution of JS code
<p>I just encountered with this code:</p> <pre><code>foo = (function() { var div = document.createElement('div'); return function(html) { div.innerHTML = html; var item = div.firstChild; div.removeChild(item); return item; }; })(); </code></pre> <p>and it is being used like this:</p> <pre><code>var element=foo('&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;table&gt;'); </code></pre> <p>I noticed that the above return the JavaScript element with it. I wonder can't it be done only with this -</p> <pre><code>var element=$('&lt;table&gt;&lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;/tr&gt;&lt;table&gt;')[0]; </code></pre> <p>What exactly the original JS function is doing actually? What is the benefit of taking this <em>var div = document.createElement('div');</em> outside the return statement ?</p>
javascript jquery
[3, 5]
5,670,338
5,670,339
Jquery Selector specific elements of a parent
<p>I have a menu that I'm building that looks something like this:</p> <pre><code>&lt;ul id="myUl"&gt; &lt;li&gt;&lt;span&gt;li #1&lt;/span&gt; &lt;ul&gt; &lt;li&gt; &lt;div class="myContent"&gt; &lt;a href="" name="myLink"&gt;clickMe!&lt;/a&gt; &lt;/div&gt; &lt;/li&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>So, i'd like to define a click handler for the <code>&lt;a&gt;</code> tag of the <code>ul</code> with the id of <code>"myUl".</code></p> <p>I tried something like a css selector like:</p> <pre><code>$('ul[id="myUl] a').on('click', do stuff!); </code></pre> <p>or</p> <p><code>$('ul[id="myUl] &gt; a').on('click', do stuff!);</code> //this doesn't work because <code>a</code> is not a direct child of <code>ul</code>.</p> <p>What's the correct way of handeling clicks of just the <code>a</code> element of this specific <code>ul</code>?</p>
javascript jquery
[3, 5]
4,732,586
4,732,587
What's the equivalent of this in Javascript?
<pre><code>print dir(someOjbect) </code></pre> <p>How can I print that in console?</p>
javascript python
[3, 7]
3,551,608
3,551,609
Asp.net handle errors on certain pages differently
<p>I have an Application_Error handler in my Global.asax file. However, I load many pages using an XHR request and would rather these "sub pages" return javascript or a real 500 code for my main app to process, rather than an error page.</p> <p>Is it possible to handle errors on certain pages in a different way? Can a master page handle its own errors in a page extending it without bubbling it up to Global.asax?</p> <p>Thanks!</p>
c# asp.net
[0, 9]
5,350,159
5,350,160
i need a solution to view uploaded photo in a data list?
<p>how to view a photo in a datalist? help me to view the photos</p>
c# asp.net
[0, 9]
3,550,892
3,550,893
Tools to assist with continual Java to C# Conversion
<p>These days, many projects have started their life written in Java. Some of them are eventually converted to C# for incorporation in .NET. Examples that come to mind are log4net, nhibernate and db4o.</p> <p>Including sharpen (which is db4o's tool) have you seen and/or used any tools that make continual conversion manageable. I'd go so far as to say anything that requires more than about a 2 month slip from the original product release isn't really all that useful for continual conversion.</p>
c# java
[0, 1]
5,145,828
5,145,829
How can I view the data attributes value live in the chrome developers tool?
<p>I want to see the values as I explore the DOM in the developers tool. And also if possible see what binded to the element javascript wise. Is this possible using some plug in or how would I go about doing this?</p>
javascript jquery
[3, 5]
3,453,656
3,453,657
Change styling of part of text
<pre><code>&lt;script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/5968383.js"&gt;&lt;/script&gt; &lt;noscript&gt; &lt;a href="http://polldaddy.com/poll/5968383/"&gt; This is a test question ? &lt;/a&gt; &lt;/noscript&gt; </code></pre> <p>The css class which styles the text "This is a test question" is "pds-question-top". Is it possible to style part of this text, ie change the colour of "This" to blue ?</p> <p>Here it is on jsfiddle : <a href="http://jsfiddle.net/25LjE/" rel="nofollow">http://jsfiddle.net/25LjE/</a></p>
javascript jquery
[3, 5]
1,344,588
1,344,589
jquery automatically scrolling table rows but with table header fixed?
<p>I know there are code sample/plugins out there to make the header fixed and the table scrollable. But I want to achieve is <strong>automatically</strong> scrolling table data rows once it's loaded, but keep the header fixed.</p> <p>Is there a plugin/jquery code to do just that?</p> <p>thanks</p>
javascript jquery
[3, 5]
4,147,934
4,147,935
How to close a print window in a browser using javascript
<p>I need to close print window of a browser using java script or any other method, java script is more preferable. If you possible close the print window for IE ,Chrome and Safari will be grateful. </p> <p>pls help..</p> <p>thanks guys.</p>
javascript jquery
[3, 5]
3,383,812
3,383,813
Is there any way to get the image of the first page of pdf file in c#?
<p>Am looking for a way to get image of the first page in pdf file using c# Any solution ?? </p>
c# asp.net
[0, 9]
1,280
1,281
Inserting Element Based on a Condition
<p>I want to insert different url's dynamically after checking a condition</p> <p>Here's the pseudocode</p> <pre><code>If div.id = "abc" then create url &lt;a href="www.zzz.html"'&gt;Cosmetics&lt;/a&gt;'); Append url to div else if div.id = "xyz" then create url &lt;a href="www.abc.html"'&gt;LEather goods&lt;/a&gt;'); Append url to div else if div.id = "mno" then create url &lt;a href="www.kkk.html"'&gt;Diapers&lt;/a&gt;'); Append url to div </code></pre> <p>and so on.</p> <p>How can I write this in JavaScript/jQUery. How to handle the code efficiently if there are 15 such If-Else conditions.</p> <p>This code is not looking good</p> <pre><code>if $("#abc) then var dynLink = $('&lt;a href=zzz.html"'&gt;Cosmetics&lt;/a&gt;'); $("#abc").append(dynLink); else if $("#xyz") var dynLink = $('&lt;a href=abc.html"'&gt;LEather&lt;/a&gt;'); $("#xyz").append(dynLink); </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
2,389,308
2,389,309
keep content stay on tab1 after filling in tab2
<p>Seen from the attached image, the page has a tab menu. After filling in the information on the tab 1, then going to fill in tab 2. After completing to fill tab2, the content is lost on the tab1, because page refreshed after fill in tab2</p> <p>My question is how to keep content stay on tab1 after filling in tab2?</p> <p><strong>UPDATE</strong></p> <p><strong>If page isn't refresh after filling in tab2, the content will stay on tab1. However, the page refresh is required in the code for some reason.</strong></p> <p><img src="http://i.stack.imgur.com/SyJDN.jpg" alt="enter image description here"></p>
php javascript jquery
[2, 3, 5]
620,372
620,373
Using Javascript to change a value in a textbox
<pre><code>&lt;input id="NameAjax" class="ac_input" type="text" value=""&gt; </code></pre> <p>And using jquery:</p> <pre><code>).click(function(e) { document.getElementById("NameAjax").value = 1; } </code></pre> <p>But after the click the value does not change:</p> <pre><code>&lt;input id="NameAjax" class="ac_input" type="text" value=""&gt; </code></pre> <p>I am looking for the output to look exactly like:</p> <pre><code>&lt;input id="NameAjax" class="ac_input" type="text" value="1"&gt; </code></pre> <blockquote> <p>How to fix it ?</p> </blockquote>
javascript jquery
[3, 5]
5,061,964
5,061,965
How to set focus for AutoCompleteText View if value entered is wrong
<pre><code>setOnFocusChangeListener(new OnFocusChangeListener() { @Override public void onFocusChange(View v, boolean hasFocus) { // TODO Auto-generated method stub if (currentfocus==false) { if (!v.hasFocus()) { currentfocus=true; v.requestFocus(); return; } } if(currentfocus==true) { if(v.hasFocus()) { v.clearFocus(); } } } }); </code></pre>
java android
[1, 4]
2,901,418
2,901,419
Detecting form changes on beforeunload?
<p>This has already been asked, I know, but I don't understand why this isn't working for me.</p> <p><a href="http://jsfiddle.net/M9tnP/16/" rel="nofollow">http://jsfiddle.net/M9tnP/16/</a></p> <p>Trying to detect form changes, and if the user tries to navigate away, I want them to confirm that they will lose their changes...</p> <pre><code>var dirty = false; $("form#add_item :input").change(function() { dirty = true; }); $("window").on('beforeunload', function() { if (dirty) { return 'You have unsaved changes! If you leave this page, your changes will be lost.'; } </code></pre> <p>});​</p>
javascript jquery
[3, 5]
2,852,771
2,852,772
Download a file from save as window using Java and Javascript
<p>I'm generating a report in my application and saving it somewhere in my PC. Now when user clicks on download button a Save as window should open and the file should get written to the specified location with the specified name. I'm able to do writing of file to another file but I'm unable to get the Save as window.</p> <p>How to download a file from save as window using Java and Javascript?</p> <p>Sorry! The types of file can be either HTML or PDF or CSV.The content of file is table containing few values and results.</p> <p>Its a desktop application. Right now I'm saving the file to my hard coded location.After saving if ever user clicks download button,a Save as window should open so that the user can save the five to his specified location.I'm using Java,Spring,Hibernate and JavaScript.</p>
java javascript
[1, 3]
3,835,392
3,835,393
Animate OnComplete firing too early
<p>I'm implementing a progress bar (for timing a background task, I already know the exact time it will take) - but I'm having trouble with the oncomplete event firing early.</p> <pre><code>$("#go").on("click", function(event){ event.preventDefault(); $('#report-loader .bar').animate({ width: 500 }, { easing: 'linear', duration: 500, complete: function() { alert('complete'); } }); }); </code></pre> <p>​ ​</p> <p>Here's a JSFiddle that shows an example of what I mean: <a href="http://jsfiddle.net/ezE8b/1/" rel="nofollow">http://jsfiddle.net/ezE8b/1/</a></p>
javascript jquery
[3, 5]
820,879
820,880
jquery set input val() and return the parent html() get empty input?
<p>i make a function to input some field and return the html to show:</p> <pre><code>function get_goodinput(GoodsSn, InCount, SellCount, Barcode, SinglePrice, BatchNo) { var $c = $('#t_addgoods_table').clone(); $c.children("form").attr("id", "addgoods_form"); //id="t_addgoods_table" var $f = $c.children("form"); $f.find("input[name='BatchNo']").val(BatchNo); $f.find("input[name='SinglePrice']").val(SinglePrice); $f.find("input[name='Barcode']").val(Barcode); $f.find("input[name='SellCount']").val("sssssssssssssssssssssss"); alert($f.find("input[name='SellCount']").val()); //this step can get the val.. $f.find("input[name='InCount']").val(InCount); $f.find("select[name='GoodsSn']").val(GoodsSn); return $c.html(); } </code></pre> <p>and show in the <a href="http://metroui.org.ua/dialog.php" rel="nofollow">metroUI dialog</a> </p> <pre><code> $('#addgoods').click(function (e) { $.Dialog({ 'title' : '添加商品', 'content' : get_goodinput("aaa", "aaa", "", "12", "12312", "aaaaa"), 'draggable' : true, 'buttonsAlign' : 'right', 'closeButton' : true, 'position' : { 'zone' : 'center', 'offsetY' : 100 }, 'buttons' : { '确定' : { 'action' : function () { </code></pre> <p>but i always get the empty input...why??? <img src="http://i.stack.imgur.com/PudI4.png" alt="enter image description here"></p> <p>the html code:= = <img src="http://i.stack.imgur.com/vW7xT.png" alt="enter image description here"></p>
javascript jquery
[3, 5]
4,302,618
4,302,619
Safest way to exchange data between java android app and PHP script?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2259438/how-to-implement-communication-between-java-client-application-android-and-php">How to implement communication between Java client application (Android) and PHP server application?</a> </p> </blockquote> <p>I'm busy with a project. My android app needs to request server info from time to time. </p> <p>The solution i came up with was to write a php script. But how do you let the android java app communicate with the PHP script ? </p> <p>I was thinking about something with a post/get request and the php script returning a html file with strings ? </p> <p>Would love some advice, thanks in advance :)</p>
java php android
[1, 2, 4]
1,515,513
1,515,514
How can I run JavaScript code at server side Java code?
<p>I want to run JavaScript code at the server side. I want to manipulate result returned by JavaScript inside my Java code. How can it be done?</p>
java javascript
[1, 3]
1,365,338
1,365,339
jscript 'type' attribute
<p>Im trying to implement the following logic on javascript. </p> <p>If type is 'bankAccountTypeId' get all fields with the same className as field using $(field.className) then use .each to loop through each result compare field.value with $(this).val() and use alert to show an error message if they are different (break if fail).</p> <p>function onChange_productListField(field, type) {</p> <pre><code> if (HimmsJSUtil.elementHasClass(field, 'DC')) { var allProductGroupFields = $(".DC."+type); var value = field.value; if (field.options) { value = HimmsJSUtil.getSelectedDropDownOption(field); } allProductGroupFields.each(function(index) { if ($(this).attr("id") != field.id &amp;&amp; !$(this).val()) { $(this).val(value); } }); } else { /* implement the logic here */ } </code></pre> <p>}</p> <p>My question is , how would the type attribute work, within this logic? </p>
javascript jquery
[3, 5]
2,905,464
2,905,465
How can I keep the focus on an input field if the input is incorrect
<p>Given the following code:</p> <pre><code>sPosSelect="#fpJpos input[name=posnum" + iiPos + "]"; if (fIn&gt;fPosMaxWtUse[iiPos]) { alert(sprintf('%.0f is %.0f more than the position max of %.0f.',fIn,fIn-fPosMaxWtUse[iiPos],fPosMaxWtUse[iiPos])); $(sPosSelect).val(''); $(sPosSelect).focus(); return; } </code></pre> <p>It works in that I get the alert, and the field is blanked. However, the focus then moves on to the next field when what I want is for it to stay on the field just blanked so the user can try again.</p> <p>All suggestions are welcome, including anything I'm doing that could be done in a better way.</p> <p>Terry </p>
javascript jquery
[3, 5]
3,189,313
3,189,314
How to show a hidden div if hash matches its ID
<p>I have a page with a bunch of hidden <code>&lt;div&gt;</code>’s. I want to be able to link directly to any of them and have them show if the hashtag matches the <code>id</code>. I already have </p> <pre><code>var thisHash = window.location.hash; if(window.location.hash) { $(thisHash).show(); } </code></pre> <p>I need to make sure <strong>every</strong> other <code>&lt;div&gt;</code> is hidden though. I can add a class if the hash matches the <code>&lt;div&gt;</code> but I’m not sure how to go about checking to see if the <code>id</code> of the <code>&lt;div&gt;</code>'s <code>id</code> matches the <code>.hash</code>. </p>
javascript jquery
[3, 5]
2,716,571
2,716,572
How to concat string to List C#
<p>I was trying to add the strings to the List and export the list as csv file but the result I got is not the way I want. Here is the code -</p> <pre><code>List&lt;string&gt; values = new List&lt;string&gt;(); using (StreamReader sr = new StreamReader(filePath)) { while (sr.Peek() != -1) { string line = sr.ReadLine(); List&lt;string&gt; lineValues = line.Split(',').ToList(); var tempMinInt = 1; var tempValue = 1; var tempValInt = Convert.ToInt32(lineValues[4]); if (tempValInt % 60 != 0) { tempMinInt = (tempValInt / 60) + 1; tempValue = tempMinInt * 30; } else { tempMinInt = tempValInt / 60; tempValue = tempMinInt * 30; } values.Add(lineValues + "," + tempValue.ToString()); } } </code></pre> <p>Here is the sample input data: </p> <pre><code>33083,2011-12-19 05:17:57+06:30,98590149,1876,258 33084,2011-12-19 05:22:28+06:30,98590149,1876,69 33085,2011-12-19 05:23:45+06:30,98590149,1876,151 33086,2011-12-19 05:30:21+06:30,98590149,1876,58 33087,2011-12-19 06:44:19+06:30,949826259,1876,66 </code></pre> <p>And here is the output data:</p> <pre><code>System.Collections.Generic.List`1[System.String],150 System.Collections.Generic.List`1[System.String],60 System.Collections.Generic.List`1[System.String],90 System.Collections.Generic.List`1[System.String],30 System.Collections.Generic.List`1[System.String],60 </code></pre> <p>Please advice. Thank you.</p>
c# asp.net
[0, 9]
1,034,823
1,034,824
Disabling controls within a table - JQuery/Javascript
<p>I have a complex UI with several nested tables, a repeater control and several other HTML controls that have their disable attribute set based on business logic in JQuery.</p> <p>I need a way to disable the entire table (including nested controls, UI elements etc) and re-enable them when a user toggles a button. </p> <p>I could iterate through the controls, find each of them and apply the "disable" attribute, but when the user chooses to enable, I will need to go through the trouble of checking if each of the control was initially enabled or not (based on the business logic as explained in para 1)</p> <p>All I need is a way to leave the initial UI alone and overlay the disable/enable functionality on the UI.</p> <p>Is there a easy way of accomplishing this?</p>
javascript jquery
[3, 5]
4,587,046
4,587,047
Mathematical way of getting set of numbers from one number
<p>I am using javascript, but I think that the idea applies across all languages. The idea is if you have 1 of 4 numbers you can get the other numbers. Something like this:</p> <pre><code>1 = 234 2 = 134 3 = 124 4 = 123 </code></pre> <p>If you have 1 you output 234, and etc. whats the most efficient way to do this? Do you have to use arrays, loops?</p> <p><strong>something like:</strong></p> <pre><code>var fruits = ["#apple", "#orange", "#peach"]; for (i = 0; i &lt;= fruits.length-1; i++) { $(fruits[i]).show; $(fruits[WANT TO BE not i]).hide;//on loop would want to be other number besides i $(fruits[WANT TO BE not i]).hide;//on loop would want to be other number besides i } </code></pre>
javascript jquery
[3, 5]
5,445,138
5,445,139
Remove space between buttons
<p>i have bunch of buttons within linear layout. But there is spaces buttons. I set padding as 0 but there no change. There is someone who already had the same problem at <a href="http://www.mail-archive.com/android-developers@googlegroups.com/msg51104.html" rel="nofollow">http://www.mail-archive.com/android-developers@googlegroups.com/msg51104.html</a> but no answer at there. Can you plese help me.</p>
java android
[1, 4]
1,881,128
1,881,129
Open dialog from server side
<p>Basically on the client side i have this jquery function</p> <pre><code>function OpenDialog() { $('.jqmWindow').jqm(); $('#ConfirmEnquiry').jqmShow(); } </code></pre> <p>I want to call this function when an imageButton is clicked, but i want to call it from server side, from a Vb file.</p> <p>Vb code</p> <pre><code> Protected Sub btnimg_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnimg.Click 'opendialog here </code></pre> <p>any help would be aprreciated</p>
jquery asp.net
[5, 9]
5,881,688
5,881,689
Getting class name from div
<p>I want to retrieve the class name of the last child element (class last div <code>new3</code>) in <code>.find_class</code>, but my code gives me class <code>select3</code>. How can I fix it?</p> <p><strong>Demo:</strong> <a href="http://jsfiddle.net/gBxan/5/" rel="nofollow">http://jsfiddle.net/gBxan/5/</a></p> <pre><code>&lt;div class="find_class mediumCell"&gt; &lt;div class="new1 old1"&gt; &lt;div class="select1"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="new2 old2"&gt; &lt;div class="select2"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="new3 old3"&gt;&lt;!-- I want to get this div's class name 'new3' --&gt; &lt;div class="select3"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/div&gt; var find = $('div.find_class div:last').attr('class'); alert(find); </code></pre>
javascript jquery
[3, 5]
2,578,731
2,578,732
In C#/ASP.NET What is this config error and how do I deal with it?
<p>I am getting an error: "The requested page cannot be accessed because the related configuration data for the page is invalid."</p> <p>In more detail, the config error is: "This configuration section cannot be used at this path. This happens when the section is locked at a parent level. Locking is either by default (overrideModeDefault="deny"), or set explicitly by a location tag with overrideMode="Deny" or the legacy allowOverride="false"."</p> <p>Also inside my visual studio, I get the error: "It is an error to use a section registered as allowDefinition = "MachineToApplication" beyond application level. This error can be used by a virtual directory not being configured as an application in IIS."</p> <p>We are running Windows Server 2008</p> <p>Please help! Thankss!</p>
c# asp.net
[0, 9]
5,897,658
5,897,659
jQuery/Javascript custom email validation not working
<p>I didn't want to us a plugin for simple email validations so i tried to create my own but it doesn't work. Its always returning false. Here is my code:</p> <pre><code>var regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i; if(regex.test($("#email").val())) { //pass } </code></pre> <p>What am I doing wrong? Thank you!</p>
javascript jquery
[3, 5]
5,164,502
5,164,503
Jquery-Delete all the row if first td of row does not have the id with given value
<p>I have a table with many rows. from which i want to delete all the rows except the row, of which first td has a given id.</p> <p>i am in half way </p> <pre><code> &lt;tr&gt; &lt;td id="1" class="td_link" onclick="viewPointDetails(1)"&gt;Barrackpur&lt;/td&gt; &lt;td class="td_link" id="11" class="edit_client" onclick="editPoint(1)"&gt;India&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="2" class="td_link" onclick="viewPointDetails(2)"&gt;Madiwala&lt;/td&gt; &lt;td class="td_link" id="11" class="edit_client" onclick="editPoint(1)"&gt;India&lt;/td&gt; &lt;/tr&gt; </code></pre> <p>​</p> <p>and my jquery;</p> <pre><code> $('tr').each(function () { if first td does not have given id say 1 then delete this row. }); </code></pre> <p>my First row is header. so i dont want this to be checked(do not want this row to be deleted).</p>
javascript jquery
[3, 5]
4,330,909
4,330,910
Bundle additional apps (built by myself) in one app?
<p>I have built a launcher for people with bad eyesight, I have 3 additional apps made specifically for universal access: a calculator, a weather app and a music player.</p> <p>To include them in my launcher I could simly copy their codes inside my launcher package and use an intent to open them (they would basically be different activities of the same app) but the problem is that my launcher is already built to launch regular apps (like every launcher does) and I don't want to mess up the code adding icons with a different behavior.</p> <p>A couple of times I've downloaded an app in android and ended up with more apps that I wanted most of the time these ones containing some sort of spam. So while this is an annoying use of the feature it shows this is possible. But I have not come across this for a while, so I'm wondering if it's still possible.</p> <p>How can I bundle my apps in the same app download? Is it still possible? How is this case scenario currently handled?</p>
java android
[1, 4]
241,385
241,386
Moving Objects Help
<p>I want to know how is it possible,I could have an Object drawn at a certain point and move to the point that is touched on the screen. I am trying to use it for my game where when the user touches on the screen, the gun fires from the position of the player, but the player is stationary. </p> <p>Thanks in advance.</p> <p>P.S. </p> <p>Is there a visual graphic of some sort that shows where every plot is on android. </p>
java android
[1, 4]
1,879,365
1,879,366
Calling Javascript function multiple times
<p>I have a Simple JavaScript Function:</p> <pre><code>function f1() { alert("HI"); } </code></pre> <p>I'm calling the same Javascript function from two places, say:</p> <pre><code>&lt;input type="submit" id="btn1" onclick="f1()"/&gt; &lt;input type="submit" id="btn2" onclick="f1()"/&gt; </code></pre> <p>How to find the target element which called this Function?</p> <p>EDIT: How to check if the element is a button or some other? </p>
javascript jquery
[3, 5]
1,783,869
1,783,870
Error when exporting data to PDF from C#
<p>I am writing a PDF file from C# like this:</p> <pre><code>Response.ContentType = "application/vnd.pdf"; Response.AddHeader("content-disposition", "attachment;filename=test.pdf"); Response.Write("&lt;table border='1px'&gt;"); /* Print Headers */ Response.Write("&lt;tr&gt;"); Response.Write("&lt;th colspan='" + colspan + "'style='background-color:SlateGray;font-size:16;height:25;color:white;'&gt;&lt;b&gt;List of Candidates "&lt;/b&gt;&lt;/th&gt;"); Response.Write("&lt;/tr&gt;"); Response.Write("&lt;tr&gt;"); </code></pre> <p>When I save the file and open it, it throws an exception that file is not supported file type .. or file has been damaged.</p>
c# asp.net
[0, 9]
5,180,175
5,180,176
enlarge image in new window - centered?
<p>enlarging an image in a new window when a user clicks on it. Here's the Javascript I used:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;SCRIPT language="JavaScript"&gt; &lt;!-- function PopUp(pPage) { window.open(pPage,'popWin','resizable=yes,scrollbars=yes,width=580,height=460,toolbar=no'); } //--&gt; &lt;/SCRIPT&gt; &lt;/head&gt; &lt;body&gt; &lt;A href="javascriptopUp('picture.jpg');"&gt;&lt;img src="thumbnail.jpg" alt="" border=0&gt;&lt;/a&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>This has worked great for me but I need to have the large image in the new window centered. I've tried adding "align=center" to various parts of both the part of the code as well as the part of the code. Nothing has worked. </p>
javascript jquery
[3, 5]
1,807,757
1,807,758
the pre-init fucntion
<p>i am working in a specific task. I have three master pages with three different stylesheet,</p> <p>I have a javascript function that can detect what the user is using for example window,mobile or i pad...</p> <p>when the page size for example is less than 700 i want to set master page 1 foe example and when the page size is greater than 700 i want to set it as master page 2 on the pre-init function of the server side </p> <p>would anyone have a clue to solve my problem </p>
c# javascript
[0, 3]
3,019,173
3,019,174
jQuery: mouseover makes image visible that has the same last 4 numbers in their id as the trigger
<p>I am currently working on a website and got stuck with the following problem: </p> <p>On the website I have small dots (images) with the ids "dot0001", "dot0002", "dot0003", etc. . I also have hidden images (visibility:hidden) with the ids "info0001", "info00002", "info0003", etc. </p> <p>I am looking for a jQuery solution. What I need is a code that allows the following events:</p> <p>When users move the mouse over "dot0001" the image "info0001" becomes visible and when they leave "dot0001", "info0001" becomes invisible again. Same applies to "dot0002"-"info0002" , "dot0003"-"info0003" etc. So only the info-images with the corresponding 4 digit number become visible. </p> <p>I gave it endless tries but got nowhere and there is not even a point in pasting my code.</p> <p>Any help appreciated! </p>
javascript jquery
[3, 5]
1,420,452
1,420,453
trying to replace all \n inside textarea to '\n (4 spaces) ' and viceversa but only one \n is found
<p>here's the link where I'm trying this:</p> <p><a href="http://jsbin.com/ajirim/2/edit#source" rel="nofollow">http://jsbin.com/ajirim/2/edit#source</a></p> <p>the js code:</p> <pre><code>$(function(){ $('button').click(dao); }); function dao() { var x = $('textarea').val(); if(x.substring(0,4) == ' ') { x = x.replace('\n ','\n').substr(4); } else { x = ' '+ x.replace('\n', '\n '); } $('textarea').val(x); } </code></pre>
javascript jquery
[3, 5]
5,444,489
5,444,490
Changing input element value in the fly
<p>I'm trying to create a voting system. So when the user clicks the "Vote" button, I want to display the vote count alongside which reflects the count in real time.</p> <p>I'm using a code something like</p> <p>HTML</p> <pre><code>&lt;div class='left'&gt; &lt;input id='vote' name='voteCount' type='button' value='1' /&gt; &lt;/div&gt; </code></pre> <p>JavaScript</p> <pre><code>$.ajax({ type: "POST", url: "vote.php", data: dataPass, cache: false, success: function(html){ $("#vote").val() = count; } }); </code></pre> <p>I'm using the input button to display the vote count since I think it's easier for me to get the button value using jQuery <code>.val()</code> (which is going to be the vote count at present) then increment it when a user votes it and display the vote count simply by setting the new value as the value of the button.</p> <p>However, the above codes doesn't seen to work. The value doesn't update after setting it. So can anyone tell me what's the best way to display the vote count in real time?</p>
javascript jquery
[3, 5]
3,865,114
3,865,115
jQuery or JavaScript?
<p>Since jQuery has grown into a very large, and popular JavaScript library I was wondering what's used in the "industry", especially in web development?</p> <p>I know JavaScript, and it's probably a good idea for anyone wanting to use jQuery to have a firm grasp of it, but if you become reliant on using jQuery as opposed to using vanilla JavaScript can this be a bad thing?</p> <p>These days I rarely worry about "cross browser" scripts because jQuery, for the most part, can handle that. When doing web development work I don't think there's been a single occasion when I've not used JavaScript without the jQuery library.</p> <p>Even things like</p> <pre><code>$().ready(function() { ... }); </code></pre> <p>... is a huge time saver. And if I had to develop without the library I'd honestly feel a little lost for some of the types of UI's I develop.</p> <p>So I guess the question is should one rely on the jQuery library? These days is it uncommon to develop UI's without it (or another similar library).</p> <p>I only ask because I applied for a UI Developer job and they requested that I know JavaScript. How much JavaScript I don't know but there was no mention of jQuery.</p>
javascript jquery
[3, 5]
5,581,345
5,581,346
What is the most convenient way to load/save property files in Android?
<p>I was thinking about using the functionality built in the <code>Properties</code> API then I found the <code>AssetManager</code>. Is there some very simplistic way for loading/saving property files in Android? One that doesn't involve messing with Input/Output streams.</p>
java android
[1, 4]
1,718,252
1,718,253
Difference between blur and fousout, focus and foucusin with example
<p>Can anyone tell me the difference between blur and fousout, focus and foucusin with simple example </p>
javascript jquery
[3, 5]
3,796,083
3,796,084
change list view
<p>I want to use custom <code>List adapter</code> in this example so that I can get the benefit of <code>getView()</code> and then get the <em>id</em> for the buttons in <em>list view</em>. </p> <p>So that I will be able to retrieve (name_id) <em>student</em> from database as list with <code>delete</code> buttons.</p> <p>And I want to implement <code>delete</code> so that when a user clicks <code>delete</code> it will take the <code>id</code> of <em>student</em> and delete it from database. </p> <p>How can I change my adapter here to a custom List adapter? </p> <p>My code is the following:</p> <p>Note that if there is an easy way without changing the adapter I could make an <code>id</code> for each button. Because I heard that I must use custom list adapter...</p>
java android
[1, 4]
5,126,921
5,126,922
Ajax Long Poll ,PHP or Python which uses least Memory?
<p>Which Language would be better to implement long ajax poll, i heard php uses more memory in long ajax poll, is that correct?</p>
php python
[2, 7]
967,450
967,451
Advice about how to animate the background of a list item
<p>I was wondering if you can offer me a better way of achieving the effect Ive created in this fiddle: <a href="http://jsfiddle.net/YLuKh/1/" rel="nofollow">http://jsfiddle.net/YLuKh/1/</a></p> <p>Basically I would like to animate the background colour of the anchor tag revealing an image which I've done by positioning an anchor tag on top of a span on top of an image and then on hover animate the width of the span. Can anyone suggest a more straight forward way of doing this?</p> <p>HTML</p> <pre><code>&lt;ul id="test"&gt; &lt;li&gt; &lt;a href=""&gt;This is the link&lt;/a&gt; &lt;span class="bg"&gt;&lt;/span&gt; &lt;img src="http://www.ritaxxii.org/wp-content/uploads/Luxury-Bedroom-Furniture-1.jpg" /&gt; &lt;/li&gt; &lt;/ul&gt;​ </code></pre> <p>JS</p> <pre><code>$(document).ready(function() { var li_width = $('#test').find('li').width(); console.log(li_width); $('#test').find('li').on('mouseover', function() { $(this).find('.bg').stop().animate({ width: '0' }, 200); }).on('mouseout', function() { $(this).find('.bg').stop().animate({ width: li_width }, 200); }); });​ </code></pre>
javascript jquery
[3, 5]
5,295,497
5,295,498
Prevent jQuery() from executing javascript
<p>I am working on some code that uses jQuery to parse data out of html documents from the web. This decision was made because jQuery, with its awesome ability to select objects on a page, makes it excellent for parsing.</p> <p>The code works like this (where 'html_string' is the html of a whole web page):</p> <pre><code>var page = $(html_string); </code></pre> <p>The problem I am having is that javascript is being evaluated and executed within the html_string as well. This results in new threads being formed that in some cases, contain infinite loops that make repeated requests to the server and eventually crash the whole client-side of application (not the server).</p> <p>Is there a way to somehow prevent the execution of javascript in this situation. In this situation, the execution of javascript is an unwanted side effect.</p> <p>Thanks so much!</p>
javascript jquery
[3, 5]
4,882,366
4,882,367
Jquery: increase the current form input value with 1
<p>I'm just trying to get a number from a hidden form input and plus 1 to that number and then put that value to the incremented number.</p> <p>Here is my code</p> <pre><code>jQuery('#add_slider_image').live('click', function() { var slideId = jQuery('#count-level').attr('value'); jQuery('#count-level').attr('value',slideId+1); }); </code></pre> <p>What am I doing wrong? as it changes the value to 11 or even 111 depending on the amount of clicks. It needs to add the value with 1. like 1+1=2 not 11.</p> <p>Thanks</p>
java jquery
[1, 5]
48,968
48,969
Read JavaScript variables from a file with Python
<p>I use some Python scripts on server-side to compile JavaScript files to one file and also add information about these files into database. For adding the information about the scripts I now have yaml file for each js file with some info inside it looking like this:</p> <pre><code>title: Script title alias: script_alias </code></pre> <p>I would like to throw away yaml that looks redundant here to me if I can read these variables directly from JavaScript that I could place in the very beginning of the file like this:</p> <pre><code>var title = "Script title"; var alias = "script_alias"; </code></pre> <p>Is it possible to read these variables with Python easily?</p>
javascript python
[3, 7]
1,509,900
1,509,901
jQuery onchange select option
<p>Let's say I have this HTML:</p> <pre><code>&lt;select id='list'&gt; &lt;option value='1'&gt;First&lt;/option&gt; &lt;option value='2'&gt;Second&lt;/option&gt; &lt;option value='3'&gt;Third &lt;/option&gt; &lt;/select&gt; &lt;input type ="text" id="text"/&gt; </code></pre> <p>and then this JavaScript</p> <pre><code> //other variables are also declared here var x1 = 5; var x2 = 10; var value = x1 * x2; var list_value =$("#list").change(function() { $(this).val(); // just an example of how i want the function in the variable }); var nwval = value * list_value; $('#text').val(nwval); // some long piece of code // i'm also using the list_value value somewhere in the long piece of code.. </code></pre> <p>I want the val in the textbox to change as the user selects an option, I know it'll work if I wrap the change event around it, but is there any way to go about this while keeping it as that variable <code>list_value</code>?</p>
javascript jquery
[3, 5]
4,726,877
4,726,878
adding text between items on radio button control list
<p>I need to add some text between the list items, but I haven't seen a way to do this. I've looked at adding space between the items, but I can't figure out how to add text between the list items. </p> <pre><code> &lt;asp:RadioButtonList ID="RadioButtonList1" runat="server" &gt; need to add text here &lt;asp:ListItem Value="10.00" Selected="True"&gt;this is item1&lt;/asp:ListItem&gt; need to add text here &lt;asp:ListItem Value="10.00"&gt;this is item2 &lt;/asp:ListItem&gt; need to add text here &lt;asp:ListItem Value="10.00"&gt; this is item3 &lt;/asp:ListItem&gt; &lt;/asp:RadioButtonList&gt; </code></pre>
c# asp.net
[0, 9]
4,432,839
4,432,840
Replacing characters with jquery
<p>thanks in advance for your help.</p> <p>I'm using this piece of code to replace a circumflex a that keeps appearing in a website I'm working on, however it only replaces the first occurance of the circumflex a in a given tag. </p> <p>Can anyone help me extend the code?</p> <pre><code> $(function() { $('h2, h3, h4, p, a, div, body').each(function() { var $h = $(this); var html = $h.html(); html = html.replace( 'Â', '' ); $h.html( html ); }); }) </code></pre>
javascript jquery
[3, 5]
3,295,636
3,295,637
Hide DataPager if Pages = 1
<p>How do I hide the DataPager if there is only one page. I don't know how todo this but maybe in the DataPager Events I have a asp:Button when clicked it gets records of course but sometimes there will be only one record and I need to hide the pager if there is one record so it could be done on postback but I don't know what property is for the page count. If someone has the answer please leave a message thanks</p>
c# asp.net
[0, 9]
1,217,477
1,217,478
jQuery new option needs sorting
<p>I've got two dropdowns, as a result of changing the first one it triggers a jquery change() that does a post with the company id from the first dropdown. That then runs a sql query to get a list of people that work for that company and fills the select box with options. This is working fine and I've got the sql query set to ORDER BY admin_name. But when jquery starts inserting the options into the dropdown it appears to be sorting by the option value instead (admin_id). What can I do to keep the options ordered by the admin_name (the text of the option). Below is the jQuery code responsible for adding the options:</p> <pre><code>$.post("listSignedBy.php", { company_id: company_id }, function(data) { alert(data); &lt;-- this shows that the data is sorted correctly by the admin name. var select = $('#signed_by'); if(select.prop) { var options = select.prop('options'); } else { var options = select.attr('options'); } $('option', select).remove(); var obj = jQuery.parseJSON(data); options[options.length] = new Option('-- Select Signed By --', ''); $.each(obj, function(val, text) { options[options.length] = new Option(text, val); }); select.val(selectedOption); }); </code></pre> <p>Thank you for any assistance and please let me know if you need any further information to help troubleshoot/fix.</p> <p>As requested, example JSON data:</p> <pre><code>{"19082":"Aaron Smith","19081":"Becky Doe"} </code></pre> <p>So in this case what I WANT is:</p> <pre><code>&lt;option value='19082'&gt;Aaron Smith&lt;/option&gt; &lt;option value='19081'&gt;Becky Doe&lt;/option&gt; </code></pre> <p>But instead of sorting by the text, it's sorting by the value so I get:</p> <pre><code>&lt;option value='19081'&gt;Becky Doe&lt;/option&gt; &lt;option value='19082'&gt;Aaron Smith&lt;/option&gt; </code></pre>
php jquery
[2, 5]
2,291,340
2,291,341
jquery and javascripts toghether
<p>I have this jquery..</p> <pre><code>&lt;script type='text/javascript'&gt; $(document).ready(function() { $('.colnews2').hide(); $("#colnews1 li").click(function() { //alert($(this).attr("id")); $('.colnews2').hide(); var value = $(this).attr("id"); var theDiv = $("#colnews2-" + value); theDiv.slideDown(); colnews1ID=value; }); }); &lt;/script&gt; </code></pre> <p>and this javascripts.. </p> <pre><code> var pager = new Imtech.Pager(); $(document).onload(function() { pager.paragraphsPerPage = 2; // set amount elements per page pager.pagingContainer = $('#mainlevel-nav'); // set of main container pager.paragraphs = $('div', pager.pagingContainer); // set of required containers pager.showPage(1); }); </code></pre> <p>and i need them in the same php.</p> <p>I tried the following, but does not work.</p> <pre><code>&lt;script type='text/javascript'&gt; $(document).ready(function() { var pager = new Imtech.Pager(); pager.paragraphsPerPage = 2; // set amount elements per page pager.pagingContainer = $('#mainlevel-nav'); // set of main container pager.paragraphs = $('div', pager.pagingContainer); // set of required containers pager.showPage(1); $('.colnews2').hide(); $("#colnews1 li").click(function() { //alert($(this).attr("id")); $('.colnews2').hide(); var value = $(this).attr("id"); var theDiv = $("#colnews2-" + value); theDiv.slideDown(); colnews1ID=value; }); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
5,024,538
5,024,539
How to make something like the spreadsheets of Excel
<p>I need to make something like the spreadsheets of Excel, where I can add and insert more columns and rows so that prestored information could be added with no problem.</p> <p>Thus, any type of numerical function or number could be inserted in between the empty boxes or spaces. So that, for example, I could add, subtract, multiply, or divide the numbers even if we insert more numbers in between or at either ends.</p> <p>could somebody tell me how should i start it, what approach i should follow to make it in asp.net.</p>
c# asp.net
[0, 9]
1,139,020
1,139,021
How to get image width and height uploaded using ajaxfileupload asp.net
<p>I think ajaxcontroltoolkit:ajaxfileupload has too many bugs and wane. since I'm using this component frequently in my projects, I overcome to many serious disturbing bugs and functionality of this control. Now, I seriously need to get uploaded image width and height using ajaxfileupload before I save it to check either width or height are correct and based on retrieved information, informing users in case of image width and height are not compatible and then prevent the process to go further and save the picture. Any Ideas please?!</p> <p>HTML Side:</p> <pre><code>&lt;asp:AjaxFileUpload ID="AjaxFileUpload1" runat="server" onuploadcomplete="AjaxFileUpload1_UploadComplete" ThrobberID="myThrobber" MaximumNumberOfFiles="1" AllowedFileTypes="jpg,jpeg"/&gt; </code></pre> <p>Behind Code:</p> <pre><code>protected void AjaxFileUpload1_UploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e) { string filePath = "~/upload/" + e.FileName; AjaxFileUpload1.SaveAs(filePath); } </code></pre>
c# asp.net
[0, 9]
2,994,187
2,994,188
'slideDown' effect with jquery doesnt seem to work
<p>I want to use <code>slideDown</code> effect with jquery effect, however it doesnt appear to work. I think it is because the element on which I am trying to implement the effect is already visible on the screen. I think it may be required to be hidden before it can show up a slideDown effect but I am unsure as to how to implement that. Any guidance on this appreciated.</p>
javascript jquery
[3, 5]
563,326
563,327
Calendar.MINUTE giving minutes without leading zero
<p>Hi all I am using below code to get adnroid phone time,but it giving me minuts without zero if the minuts are in between 1 to 9. for example:right now I have time on my device 12:09 but its giving me as 12:9 </p> <pre><code>Calendar c = Calendar.getInstance(); int hrs = c.get(Calendar.HOUR); int mnts = c.get(Calendar.MINUTE); String curTime = "" + hrs + ":" + mnts; return curTime; </code></pre> <p>after above code I also try below code its giving same thing as above,minuts without zero before number it the minuts in between 1 to 9 . . </p> <pre><code>final Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(System.currentTimeMillis()); Date date = cal.getTime(); int mHour = date.getHours(); int mMinute = date.getMinutes(); </code></pre>
java android
[1, 4]
829,906
829,907
Associative array passing as empty string
<p>I am trying to pass an array to PHP via Ajax, but the array is being passed as an empty string. This is my code when creating the array:</p> <pre><code>var params = new Array(); var inputs = new Array(); inputs = $(":input"); $.each(inputs, function(key, value) { params[value.id] = value.value; }); alert(params); </code></pre> <p>Before that there are around 20 inputs that look like this:</p> <pre><code>&lt;input name="first_name" id="first_name" type="text" class="medium"/&gt; &lt;input name="last_name" id="last_name" type="text" class="medium"/&gt; </code></pre> <p>The <code>alert(params)</code> is just giving me an empty string. However, <code>alert(params['first_name'])</code> actually gives me the <code>first_name</code> input value.</p> <p>Why isn't the array going through?</p>
javascript jquery
[3, 5]
3,045,083
3,045,084
[Solved]Jquery click() function not working
<p>I have 2 anchor tags like this</p> <pre><code>&lt;a href="#" id="1"&gt;1&lt;/a&gt; &lt;a href="#" id="2" style="display:none;"&gt;2&lt;/a&gt; </code></pre> <p>and Jquery functions like this</p> <blockquote> <p>$(document).ready(function (){</p> <blockquote> <pre><code> $('#1').click(function(){ //code to show div 1 //code to hide div 2 </code></pre> </blockquote> <pre><code> }); $('#2').click(function(){ //code to show div 2 //code to hide div 1 }); </code></pre> <p>});</p> </blockquote> <p>Problem is when I click on "2" anchor tag, second div tag displays then when I want to again display div 1 by clicking "1" anchor tag it doesn't work. Its like after running 2nd function 1st function doesn't exist!</p> <p>Updating Question with answer: I changed the selectors to like ques-1, ques-2 and if there are two selectors with same name jquery calls only first selector, so better give selector different names even if one of them is gonna be active one at a time</p>
javascript jquery
[3, 5]
881,010
881,011
URL decoding
<p>I want to decode string which is encoded using java.net.URLEncoder.encode() function.</p> <p>i tried using unescape() function in java script.</p> <p>but problem occure for blank space because java.net.URLEncoder.encode() converts blank space to '+' and unescape() function wont convert '+' to blank space.</p>
java javascript
[1, 3]
4,615,765
4,615,766
Android / Java - Figuring out what the date will be
<p>I'm creating an application that allows the person to select a day within the current week (Days 1/Sunday through 7/Saturday) and see whats on the agenda for that day.</p> <p>The functionality I'm looking for is to check what today's date is and what day of the week it is. With this information It will show the current weekdays 1 through 7 and I want them to display the date of that day</p> <p><strong>Example:</strong> Today is Thursday 6/23/2011 (Day 5) I can find this information with the following code:</p> <pre><code>Calendar c = Calendar.getInstance(); int DayOfWeek = c.get(Calendar.DAY_OF_WEEK); Calendar c = Calendar.getInstance(); int DayOfWeek = c.get(Calendar.DATE); </code></pre> <p>I'm trying to figure out what functionality or whatever it is to end up with the following result:</p> <blockquote> <p>Sunday : 6/19/2011, Monday : 6/20/2011, Tuesday : 6/21/2011, Wednesday : 6/22/2011, Thursday : 6/23, 2011, Friday: 6/24/2011, Saturday : 6/25/2011</p> </blockquote>
java android
[1, 4]
560,998
560,999
php cache function not working on jquery .load()
<p>I'm using a standard php cache script on page.php</p> <pre><code> $cache = 'the_location/'.$id.'.html'; $expire = time() -3600 ; if(file_exists($cache) &amp;&amp; filemtime($cache) &gt; $expire) { readfile($cache); } else { ob_start(); // some stuff $pages = ob_get_contents(); ob_end_flush(); $fd = fopen("$cache", "w"); if ($fd) { fwrite($fd,$pages); fclose($fd); } echo $pages ; } </code></pre> <p>On main_page.php I'm loading page.php like so:</p> <pre><code> $('#div').load('page.php?id=' + id); </code></pre> <p>If I go straight to page.php?id=1234 the page is cached and file 1234.html appears in 'the_location' Otherwise on main_page.php nothing happens ...</p> <p>Help is much appreciated !</p> <p>Edit : Everything works on main_page.php and page.php, page.php is correctly loaded into main_page.php but not cached, if I load page.php through browser it is cached.</p>
php jquery
[2, 5]
602,759
602,760
Different content in Footer from the ItemTemplate result
<p>Can the DataList <code>FooterTemplate</code> have an altogether different query result in contrast to what we are using in ItemTemplate results, on data binding?</p> <p>For eg:</p> <pre><code>&lt;ItemTemplate&gt; &lt;tr&gt; &lt;td&gt;BookID: &lt;/td&gt; &lt;td&gt;&lt;%#Eval("bookid")%&lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;tr&gt; &lt;td&gt;Last purchase: &lt;/td&gt; &lt;td&gt;&lt;%#Eval("")% //don't have a the result in the ItemTemplate queried DataSource result. Need to do a separate query for this and enter the columnID here&lt;/td&gt; &lt;/tr&gt; &lt;/FooterTemplate&gt; </code></pre> <p>I need run a different query to get the result in footer. For this, the the same result should also be in the DataSource for the DataList, so that I can specify it using an ID.</p> <p>Any suggestions for this or should I use an altogether different control?</p>
c# asp.net
[0, 9]
408,174
408,175
scrolltop+clientY not working in Mozilla Firefox
<pre><code>var YPos12 = event.clientY + document.body.scrollTop; </code></pre> <p>is not working for Mozilla Firefox. Anyone can give me working example with code? Please help</p>
c# javascript asp.net
[0, 3, 9]
4,203,110
4,203,111
Convert url in asp?
<p>I have Web-App. Somewhere in my page I used following code to create a <code>Hyperlink</code>.</p> <pre><code>&lt;a href="&lt;%= Eval("NavigateUrl") %&gt;"&gt; &lt;%= Eval("text") %&gt; &lt;/a&gt; </code></pre> <p>as you see this code must be work but there is a little problem. content of <code>NavigateUrl</code> is something like this url.</p> <pre><code>"~/account/login.aspx" </code></pre> <p><strong>How I must resolve that URL?</strong></p> <p><em><strong>Update</em></strong> : I must say I cant Change value of <code>NavigateUrl</code> cuz that load from Xml-Datasource. I must change that in UI something like: </p> <pre><code>Eval( Resolveurl("NavigateUrl") ) </code></pre>
c# asp.net
[0, 9]