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
274,978
274,979
Change an image for a second
<pre><code> ImageView image = (ImageView) findViewById(R.id.imageview); image.setImageResource(drawable.image1); SystemClock.sleep(1000); image.setImageResource(drawable.image2); </code></pre> <p>I am trying to change the image for a second, my code above doesn't work but not sure why? Should I be using a thread? or does anyone have any better ideas?</p> <p>EDIT To clarify on the problem:</p> <p>The image being displayed as "drawable.image2" I want "drawable.image1" to be shown for one second then change to "drawable.image2".</p> <p>EDIT2:</p> <p>This code is used in the onClick. When a user clicks the image it needs to change for one second</p>
java android
[1, 4]
2,782,248
2,782,249
click event is firing asynchronasly
<p>I have a click event attached to an anchor, and I'm using multiple anchors. The user may click these anchors randomly, and each anchor click creates a dynamic UL list. Everything is working fine except when the user clicks the anchors fast, creation of UL list is happening asynchronously. I want the events to be ordered synchronously. Any solution?</p>
jquery asp.net
[5, 9]
2,112,865
2,112,866
Moving the content of an DIV to another window with JavaScript / JQuery
<p>I need to make an "Print product" feature on my ecommerce site and the print part i already figured it out ... windows.print</p> <p>My problem is that I want to copy the entire content of DIV where I have all product specifications and photos to another window which after I can print it.</p> <p>I have a link <strong>Print this product</strong> which when clicked, JQUERY must create the new window and also copy the entire product's DIV to this new window.</p> <p>I have seen several approaches here and it only confused me so that's why I am posting this here.</p> <p>Can someone please explain me with an example how to solve my problem.</p> <p>Thank you.</p>
javascript jquery
[3, 5]
1,553,631
1,553,632
Replacing the content of a <td> with <tr> id and <tr> index
<p>I have a table structure like this</p> <pre><code>&lt;table&gt; &lt;tr id="tr_1"&gt; &lt;td&gt;Content1&lt;/td&gt; &lt;td&gt;Content2&lt;/td&gt; &lt;td&gt;Content3&lt;/td&gt; &lt;td&gt;Content4&lt;/td&gt; &lt;/tr&gt; &lt;tr id="tr_2"&gt; &lt;td&gt;Content5&lt;/td&gt; &lt;td&gt;Content6&lt;/td&gt; &lt;td&gt;Content7&lt;/td&gt; &lt;td&gt;Content8&lt;/td&gt; &lt;/tr&gt; &lt;tr id="tr_1"&gt; &lt;td&gt;Content11&lt;/td&gt; &lt;td&gt;Content12&lt;/td&gt; &lt;td&gt;Content13&lt;/td&gt; &lt;td&gt;Content14&lt;/td&gt; &lt;/tr&gt; &lt;tr id="tr_2"&gt; &lt;td&gt;Content15&lt;/td&gt; &lt;td&gt;Content16&lt;/td&gt; &lt;td&gt;Content17&lt;/td&gt; &lt;td&gt;Content18&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I am passing the row index(2) and <code>&lt;tr&gt;</code> id (tr_1) to a js function for replacing the content of 2nd 3 rd td's in that row. i have a jquery funcion</p> <pre><code>document.getElementById('tr_1').getElementsByTagName("td")[2].innerHTML = '&lt;td&gt;New html&lt;/td&gt;'; </code></pre> <p>But that this replacing the first <code>tr</code> html. How we can replace with id <code>tr_1</code> with index 2</p>
javascript jquery
[3, 5]
806,601
806,602
identify object property by placement in object
<p>How do you identify an object by its place in the object.</p> <pre><code>myObj.b = 2 </code></pre> <p>can I go somethiong like <code>myObj[1] to show 2 also</code>?</p> <pre><code>var myObj = { a: 1, b: 2, c: 3, d: 4, e: 5, f: 6 } </code></pre>
javascript jquery
[3, 5]
5,504,516
5,504,517
How to set calendar date from javascript
<p>when user enters ddMMyy or ddMMyyyy.I want to convert it into dd/MM/yyyy format. To achieve this i have written a javascript. It works fine but when i focus on textbox again it doesnt show selected date as javascript converted date(i.e it doesnt fire event when i manually change the date of the textbox). How to make calendar control to select the date after calling "ConvertToDate" function?</p> <pre><code>&lt;script type="text/javascript"&gt; function ConvertToDate(txtCnt) { try { txtVal = txtCnt.value; var dd = txtVal.charAt(0).toString() + txtVal.charAt(1).toString(); var MM = txtVal.charAt(2).toString() + txtVal.charAt(3).toString(); var year = txtVal.substring(4); if (year.length == 2) year = "20" + year; var jsDate = new Date(); txtCnt.value = dd + "/" + MM + "/" + year; } catch (e) { } return false; } &lt;/script&gt; &lt;asp:TextBox ID="txtFromDt" runat="server" onblur="return ConvertToDate(this)" Width="80px"&gt;&lt;/asp:TextBox&gt; &lt;cc1:CalendarExtender ID="txtFromDt_CalendarExtender" runat="server" CssClass="cal_Theme1" Format="dd/MM/yyyy" Enabled="True" TargetControlID="txtFromDt" /&gt; </code></pre>
javascript asp.net
[3, 9]
903,838
903,839
Php/Java Integration
<p>Have u experience of integration of php and Java. I've written a class in Java "Hello". Now I want to call its method from php when I create an instance of this class from php with </p> <pre><code>$obj = new Java(Hello); </code></pre> <p>Then it gives me fatal error. I've tried many times to setup php ini variables etc but I couldn't find any thing. Please advice me how can I set it up. </p> <p>Thanks in advance </p> <hr> <p><sup><strong>Reference: <a href="http://de.php.net/manual/en/book.java.php" rel="nofollow">http://de.php.net/manual/en/book.java.php</a></strong></sup></p>
java php
[1, 2]
918,738
918,739
Loading DLC files in Python or C++ or Java
<p>Is there any Libraries that allow for loading of DLC files in Python Java or C++? FYI <a href="http://jdownloader.org/knowledge/wiki/linkprotection/container/dlc-rsdf-and-ccf" rel="nofollow">link</a></p>
java c++ python
[1, 6, 7]
92,929
92,930
Disabling transaction button until the transaction is over in asp.net page
<p>I have a transaction button on my asp.net page.If user click on transaction button then this should be disabled until transaction is over. Can anyone let me know if this can be done using client scripting ? Thanks in advance.</p>
javascript asp.net
[3, 9]
1,486,475
1,486,476
How to store hierachical data in C#
<p>I want to store all makes and models of the cars in my console application. </p> <p>So I can print them like this:</p> <pre><code> - Toyota Corolla Camry ... - Nissan Altima Sentra ... </code></pre> <p>So, I assume I need some kind of hierachical data. I was thinkng about making Class Make and Class Model. Make Has a list of models. And Then I have list of Makes. But this looks overly complicated. What is the best solution for this kind of things?</p>
c# asp.net
[0, 9]
3,627,151
3,627,152
Why heder('Location:index')not working but window.location.href='index.php' is working?
<p>I have the Index file like this</p> <pre><code>&lt;?php include('file1.php'); include('file2.php'); ?&gt; </code></pre> <p>in file1.php I am having the code like below.</p> <pre><code>&lt;?php echo "hai"; ?&gt; </code></pre> <p>I am trying to redirect the page by using <code>header('Location:index.php')</code>.It throws an error something like the output already started.I know for header if we give the echo statement it throws an error.In this situation I am trying to redirect by using Javascript <code>window.location.href='index.php'</code> .It gives me the expected output and there is no error.Why?.</p>
php javascript
[2, 3]
1,131,777
1,131,778
"System is undefined" JavaScript error when using click handler?
<p>I have a gridview with a button in one of the columns. I add columns to the gridview with the code behind. I used this line to attach my click event: </p> <p><code>cmd1.OnClientClick += new EventHandler(cmd1_Click);</code> </p> <p>Now every time I click that button, it gives me a run time error and breaks at <code>System.EventHandler</code> of <code>&lt;input type="submit" name="grvList$ctl02$ctl05" value="Add" onclick="System.EventHandler;" /&gt;</code></p> <p>Has anyone ran into this problem.</p>
c# javascript asp.net
[0, 3, 9]
1,651,107
1,651,108
How to set a comma sep. string as a paramter?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/901115/how-can-i-get-query-string-values">How can I get query string values?</a> </p> </blockquote> <p>ive a a function call like:</p> <pre><code>var ex = _.where(obj, {param1:0,param2:1}); </code></pre> <p>which works fine, all the code behind.</p> <p>I check my URL and take out the parameters and save this information into a array:</p> <pre><code> var query = window.location.search.substring(1); var vars = query.split("&amp;"); var testParamter = vars.toString().replace( /=/g,':' ); </code></pre> <p>that return by using console.log(testParamter); the following result:</p> <pre><code>param1:0,param2:1 </code></pre> <p>but i cant insert yet the var testParamter into my function call:</p> <pre><code>var ex = _.where(obj, {testParamter}); </code></pre> <p>because it is a string and i cant handel it with eval(). so can anyone tell me please the right way to solve it?</p> <p>thanks</p>
javascript jquery
[3, 5]
666,070
666,071
quick [php function] -> [javascript function] question
<p>if anyone fancies doing me a really quick favour, it would be really appreciated:</p> <pre><code>static function make_url_safe($z){ $z = strtolower($z); $z = preg_replace('/[^a-zA-Z0-9\s] /i', '', $z); $z = str_ireplace(' ', '-', $z); return $z; } </code></pre> <p>what js functions should i be looking at to convert this function to javascript?</p>
php javascript
[2, 3]
948,599
948,600
Implementing deeplinking with multiple levels
<p>I need to implement deeplinking for my site as it's built heavily in AJAX. I understand the basic idea and have got deeplinking implemented for my top level nav. Problem is my site has multiple levels. A user can click on the top nav, which adds to the hash and then click on a secondary nav and a tertiary nav. I also need to add this secondary and tertiary nav click in to the hash...and then also be able to remove that item when the user clicks back on a primary nav item. I can't think of a way to do this...any ideas?</p> <p>Oh and the code (jQuery) I'm using to achieve the hashing on the primary nav is:</p> <pre><code>updateHash : function(hash) { var hashHistory = []; location.hash = hash; } </code></pre>
javascript jquery
[3, 5]
833,953
833,954
Align text with radio button
<p>In below script : </p> <pre><code>&lt;script type="text/javascript" charset="utf-8" src="http://static.polldaddy.com/p/6352993.js"&gt;&lt;/script&gt; &lt;noscript&gt;&lt;a href="http://polldaddy.com/poll/6352993/"&gt;This is very long test question to test how polldaddy handles questions that exceed that normal length............ yes a very long question indeed..............&lt;/a&gt;&lt;/noscript&gt;​ </code></pre> <p>I amending the width of the text so it fits into 220px. This causes the text to wrap underneath the radio button if it is of a certain length. As shown in this fiddle : </p> <p><a href="http://jsfiddle.net/25LjE/8/" rel="nofollow">http://jsfiddle.net/25LjE/8/</a></p> <p>The options should wrap to right of radio button as shown in diagram : </p> <p><img src="http://i.stack.imgur.com/8Z4oX.png" alt="enter image description here"></p> <p>Is this possible ? I think I need to amend the class "pds-answer-span" ?</p>
javascript jquery
[3, 5]
1,691,800
1,691,801
Creating directory in internal storage android
<p>Is it possible to create directory in directory. To create one directory simply call this:</p> <pre><code>File dir1 = getDir("dir1",Context.MODE_PRIVATE); </code></pre> <p>But how to create other directory in <code>dir1</code> ? </p> <p>this:</p> <pre><code>File dir2 =getDir("dir1"+"/"+"dir2",Context.MODE_PRIVATE); </code></pre> <p>throw exception:</p> <pre><code>File dirFile = java.lang.IllegalArgumentException: File app_dir1/dir2 contains a path separator </code></pre> <p>Thanks.</p>
java android
[1, 4]
456,450
456,451
javascript/jquery digital clock script in 24 hour format with Date
<p>I am looking for javascript/jquery digital clock script in 24 hour format with Date. The clock should display images as its numbers and date; also the clock should initialize its time from a hidden field having server time. I am using asp.net.</p>
javascript jquery asp.net
[3, 5, 9]
3,077,553
3,077,554
Need the decimal to save and show three places
<p>I have this line of code in c# but i it always resets the textbox back to the format 0.00, how can i make it so that it keeps the format 0.000 ?.</p> <pre><code>NewYorkTax = Convert.ToDecimal(txtNewYorkTax.Text); //converts it but with 0.00, I need 0.000 or 7.861 etc.. </code></pre> <p>SIDE NOTE: NewYorkTax is of type Decimal, I need to keep this variable.. any ideas?</p> <p>Thank you</p>
c# asp.net
[0, 9]
3,037,535
3,037,536
cursor movement through eye
<p>I was thinking whether it could be possible to track cursor movement through eye. Depending on which part of screen , the eye looks the curson will move. Can this be achieved? Thansks everyone for replying!.I am just looking for some new idea that can be implemented and which have not been implemented.Any ideas/suggetions are welcomed.</p>
c# java
[0, 1]
4,241,934
4,241,935
Change background based on text in TextView in Android
<p>I'm trying to get the backgound of the layout to change based on what's in a textview. I know how to set the background in Java:</p> <pre><code>mainbg.setBackgroundResource(R.drawable.erburrows); </code></pre> <p>but if I wrap that call in an if statement, nothing happens. There are no error flags or anything, it just doesn't display anything in the background. Here's the code I'm using:</p> <pre><code> //--- BACKGROUND CHANGE --- String tvString = showBook.getText().toString(); bookDisp.setText(tvString); View mainbg = bgview.getRootView(); if(bookDisp.equals("Green Eggs")){ mainbg.setBackgroundResource(R.drawable.seuss); }else if (bookDisp.equals("Tarzan")){ mainbg.setBackgroundResource(R.drawable.erburrows); } //--- END BACKGROUND CHANGE --- </code></pre> <p>Any idea why it doesn't work?</p>
java android
[1, 4]
4,262,352
4,262,353
syntax error - use if eval() from Grid to call Javascript function
<p>can some one please tell me where is the mistake from my side, to call this function.</p> <pre><code>&lt;asp:LinkButton ID="lnkImageVideo" runat="server" OnClientClick="ShowTaskAttachmentPopup('&lt;%# Eval("AttachmentFileName") %&gt;','&lt;%#Eval ("AttachmentFilePath") %&gt;','Task Attachment'); return false;"&gt; &lt;/asp:LinkButton&gt; </code></pre> <p>if i put the function with static values (avoid eval inside grid) it works fine.</p> <p>purpose: call javascript function on row link of grid.</p>
c# asp.net
[0, 9]
2,340,015
2,340,016
setInterval on a for loop?
<pre><code>for (var i=list.length; i&gt;=0; i--){ //do something.... } </code></pre> <p>I want to use a setInterval to make this process take 1 whole min no matter how many items are in the list. So if there are 10 items it would trigger every 6sec, 30items, every two seconds, etc. </p> <p>Thanks for any help!</p>
javascript jquery
[3, 5]
1,930,565
1,930,566
JS/jQuery (Hide div, show div on click)
<p>I have two buttons.</p> <p>I have two divs I want to show.</p> <p>Each divs have different content.</p> <p>I want both divs to only take up the same amount of space on the page.</p> <p>I want it so on page load, div1 is shown, and if they click link div2, div1 disappears and div2 appears in its place.</p> <p>What is the best way to go about doing this? and how?</p>
javascript jquery
[3, 5]
5,030,543
5,030,544
jQuery Error IE JSON
<p>when I run this JS in FF or Safari it works just right but in IE I get 'optionValue' is Null or not an Object.</p> <pre><code>$(function() { $('#selectBrand').change(function(){ $.getJSON('Scripts/ajax_busquedas.php', {idMarca : $(this).val() }, function(j) { var options = ''; var i = ''; for (i = 0; i &lt; j.length; i++) { options += '&lt;option value="' + j[i].optionValue +'"&gt;' + j[i].optionDisplay + '&lt;/option&gt;'; } $('#selectCategory').html(options); $('#selectCategoy option:first').attr('selected', 'selected'); }); }); }); </code></pre> <p>Any ideas on how I can start debugging this?</p> <p>Thanks, Max</p>
javascript jquery
[3, 5]
2,878,688
2,878,689
how to pass the JavaScript variable to the php function
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/419240/how-to-get-javascript-function-data-into-php-variable">How to get javascript function data into Php variable</a> </p> </blockquote> <p>I am writing a code in javaScript. in that I need to call the php function.</p> <p>But the problem is again I have to pass the Javascript variable to the php function.</p> <p>My javascrpt is as follows,(is this correct)</p> <pre><code>&lt;script&gt; obj.value="0254" if (obj2.value != -1) { var PLOptions= "&lt;?php PLOptions(?&gt;"+ obj.value +"&lt;?php)?&gt;" } &lt;/script&gt; </code></pre> <p>Here PLOptions() is the php method and obj.value is the javascript variable.</p> <p>please let me know, how can I achive this.</p>
php javascript
[2, 3]
5,707,521
5,707,522
ontouchlisteners in textviews
<p>i am trying to implement a ontouchlistener in each and every textview that i have so that when i touch the textviews it would do a vibration</p> <p>however i have this problem "cannot reduce visibility of the inherited method from view.ontouchlistener"</p> <p>anyone has any idea what am i doing wrong? i have implemented the OnTouchListener already</p> <pre><code> for (int i = 0; i &lt; counter; i++) { tv[i] = new TextView(this); tv[i].setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT)); tv[i].setTextSize(textSize); tv[i].setText(""+singleText[i]); tv[i].setOnTouchListener(this); linearLayout.addView(tv[i]); } setContentView(linearLayout); } catch (IOException e) { //You'll need to add proper error handling here } } private boolean onTouch(View v, MotionEvent event) { vibratePattern(); return true; } </code></pre>
java android
[1, 4]
4,146,622
4,146,623
Add a new line in array
<p>I have the following code:</p> <pre><code>$('.getcode').click(function () { $('textarea').val(""); var str = []; $('#group-wrap span').each(function () { str.push($(this).attr('title') + $(this).text()); }); $('textarea').val(str.join('')); }); </code></pre> <p>Which grabs the content of each span and the value of each title attribute for the span and appends it to a textarea field.</p> <pre><code>&lt;span class="grouptitle" title="&amp;f"&gt;Group&lt;/span&gt; (Multiple spans like this) </code></pre> <p>The output is this:</p> <pre><code>&amp;f(&amp;fGroup&amp;f) &amp;fUsername&amp;f:&amp;f Hello There! </code></pre> <p>I have a button, when click, appends a new set cloned span elements</p> <pre><code>var = groupClone = $('.wrapper'); //wrapper for the span's $('.add').click(function(){ groupClone.first().clone().appendTo('#group-wrap'); }); </code></pre> <p>It kinda works, except the output is now this if I add another one:</p> <pre><code>&amp;f(&amp;fGroup&amp;f) &amp;fUsername&amp;f:&amp;f Hello There!&amp;f(&amp;fGroup&amp;f) &amp;fUsername&amp;f:&amp;f Hello There! </code></pre> <p>How can I add a new line (\n I'm assuming?) so the output is this in the the textarea? </p> <pre><code>&amp;f(&amp;fGroup&amp;f) &amp;fUsername&amp;f:&amp;f Hello There! &amp;f(&amp;fGroup&amp;f) &amp;fUsername&amp;f:&amp;f Hello There! </code></pre>
javascript jquery
[3, 5]
2,588,745
2,588,746
Server tags cannot contain <% ... %> constructs
<p>I am trying to use CDN for my images on the website. Problem is, sometimes I have server controls such as ImageButton, and I would like to use a class in order to fully extract the path of the CDN. for that purpose I tried doing:</p> <pre><code>&lt;asp:ImageButton runat="server" OnClick="Agree" ImageUrl="&lt;%=ResourceManager.GetImageCDN("iagree.png")%&gt;" /&gt; </code></pre> <p>and I get the title as error.</p> <p>Only if I'm using &lt;%# it will work (and only if I an databinding). How can I do this easily? how can I place CDN code on my markup code?</p> <p>Thanks!</p>
c# asp.net
[0, 9]
4,321,386
4,321,387
jQuery hover - div does not show up
<p>I have this jQuery code:</p> <pre><code>$("#people td, #list td").hover(function() { $(this).stop().animate({ backgroundColor: "#444" }, "fast"); $(this).find(".controls").stop().fadeIn("fast"); }, function() { $(this).stop().animate({ backgroundColor: "#333" }, "fast"); $(this).find(".controls").stop().fadeOut("fast"); }); $("#list .controls").hide(); </code></pre> <p><code>.controls</code> is a div, which contains some links to work with entry (there are for example 10 entries on the page). Everything worked until this moment and now it's not working anymore. When I open the page, <code>.controls</code> hide - that's ok. But when I hover over the <code>td</code>, css animation runs, but fadeIn does not. Same goes with the fadeOut in the second function (when mouseleave event is triggered).</p> <p>HTML is as following:</p> <pre><code>&lt;td&gt; &lt;div class="icons"&gt; &lt;/div&gt; &lt;div class="profile"&gt; &lt;div class="info"&gt; &lt;div class="name"&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="controls"&gt; &lt;a href="http://..."&gt;Link&lt;/a&gt; &lt;a href="http://..."&gt;Link&lt;/a&gt; &lt;/div&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;/div&gt; &lt;/td&gt; </code></pre>
javascript jquery
[3, 5]
3,092,283
3,092,284
Unable to get logon user no matter what procedure is used
<p>Here is the problem, I am using IIS7 inorder to host my asp.net web site , Now the thing is no matter what method is used, I am always getting the app pool identity as the current logged on user (authentication mode is windows). The following are the pieces of code i used to get the logged on user(all of them return the app pool identity).</p> <pre><code>WindowsIdentity.GetCurrent().Name Convert.ToString(Request.ServerVariables["LOGON_USER"]) WindowsPrincipal p.Identity.Name Convert.ToString(Request.ServerVariables["AUTH_USER"]).Trim() </code></pre> <p>Please help me regarding this cause this is troubling me a lot.</p>
c# asp.net
[0, 9]
1,523,540
1,523,541
Calling class methods within jQuery function
<p>So I have some javascript class and in one method I use jQuery to bind function to click event. And within this function I need to call other methods of this class. In usual js function I did it through <code>"this.method_name()"</code>, but here, I guess, jQuery redefines "this" pointer. </p>
javascript jquery
[3, 5]
4,272,040
4,272,041
alert box empty for php javascript
<p>why does this script show empty alert box. I am trying to use php value in javascript</p> <pre><code>&lt;script type="text/javascript"&gt; alert(&lt;?php echo count($myorder) ?&gt;); &lt;/script&gt; </code></pre>
php javascript
[2, 3]
1,583,320
1,583,321
java script for radiobuttonlist select and deselect
<p>i have an radio buttonlist control. in which data are coming from DB and bidning in .cs file</p> <p>now i need to write an javascript that if user select item 1 in radiobuttonlist it gets selected and again user clicks on the same item it should get deselected. </p> <p>even if i have 10 items under it this thing should open that select and deselect the item clilcking on it</p> <p>thank you </p>
asp.net javascript
[9, 3]
4,026,961
4,026,962
jQuery trim and remove on parent break child events
<p>Note: I have a workaround to this problem, but I'd prefer to comma-separate the values as I describe below rather than separating them with spaces (which is what my workaround does).</p> <p>I have an ASP.NET website that allows instructors to choose from a DropDownList of preset comments and apply these comments to students in their classes. I display the students and comments inside a GridView, and use a Label to display any comments that already exist in the database (removing them from the DropDownList in the process). When an instructor selects one of these comments and clicks a button, my jQuery function:</p> <ol> <li>Pulls the selected value and text out of the option (provided it isn't the default option).</li> <li>Checks Label.children().length, and appends a ", " to the text if it's greater than zero.</li> <li>Creates a <code>&lt;span&gt;</code> tag with a hidden field containing the value and text.</li> <li>Appends the text inside the span.</li> <li>Closes the span.</li> <li>Attaches an onclick event to the span.</li> <li>Removes the original option from the DropDownList.</li> </ol> <p>The span tag's onclick event does the reverse of what I describe above -- it pulls the value and text out and re-creates the option inside the drop-down menu. Additionally, it replaces strings like ", , " with ", " in the parent Label. I've found that when I replace these strings (which lie outside the spans I've attached the onclick events to) that the onclick events go away.</p> <p>I'm familiar with .live(), but because each row in this GridView contains a unique reference to the particular student and class currently in use, I can't know the values that each row needs to pass into the funciton ahead of time. Is there any solution to this problem other than my described workaround or re-attaching the onclick event?</p>
javascript jquery
[3, 5]
1,087,050
1,087,051
Jquery selector help
<p>I have the following:</p> <pre><code>&lt;form id="my_form"&gt; &lt;input type="checkbox" name="a" value="a"&gt; Check &lt;img src="..." /&gt; &lt;/form&gt; </code></pre> <p>To handle the check and uncheck events I do (and this works):</p> <pre><code>$('#my_form :checkbox).click(function() { if($(this).is(':checked')) { //... } //... }); </code></pre> <p>My question is: inside of that click function, how can I select the <code>&lt;img&gt;</code> tag that is right beside the checkbox? Can I do this without specifying an ID for the image? ..by "select" I mean that I need to be able to hide() and show() it. Thanks</p>
javascript jquery
[3, 5]
3,411,851
3,411,852
Jquery marquee and accordion clashing
<p>i have a jquery marquee on my page, and also an accordion. </p> <p>However with having both of them on a page the marquee stops working, the only library im using is jquery, could anybody tell me the best way to start debugging this? </p> <p>thanks </p>
javascript jquery
[3, 5]
6,028,919
6,028,920
How to combine keypress & on click function in JavaScript?
<p>I have the following two functions:</p> <pre><code>$("input").keypress(function(event) { if (event.which == 13) { //code } }); $('#login_submit').click(function () { //code }); </code></pre> <p>The code which is being used in the functions are EXACTLY the same code, basically code dublication. So i was wondering if there is a way to combine these functions with an OR statement??</p>
javascript jquery
[3, 5]
5,338,135
5,338,136
JavaScript: How to efficiently replace all values of an object without replacing the object
<p>I have a number of objects collected in an array. The same objects are also attached to certain DOM elements for various reasons. From time to time I need to update one of these objects. The easiest way to do this is to find the object in the array with the same id property as the one I got new values for through AJAX and then replace it. But this of course creates a new object and the objects attached to DOM elements are no longer the same. Which means that if I would compare them they would not be the same object anymore.</p> <p>How can I easiest replace the correct object with the values in the new object without replacing the actual object? (So that the reference remains the same)</p> <p>Example of what I don't want</p> <pre><code>var values = [{id:1, name:'Bob'}, {id:2, name:'Alice'}, {id:3, name:'Charlie'}]; var bar = values[2]; console.info(bar === values[0]); // True var newValue = {id:1, name:'Dave'}; // Somehow find the index of the object with id==3 values[2] = newValue; console.info(bar === values[2]); // False, should still be true </code></pre> <p>Only way I can think of is looping through the object with a foreach or something, but hoping there is something built-in to javascript or jQuery or something that allows for more efficient or at least cleaner code.</p>
javascript jquery
[3, 5]
982,198
982,199
how to detect clicks count within 5 seconds
<p>I want to count mouse clicks on anywhere of page with jQuery.</p> <p>If user clicks more than 10 click within 5 second I want to give a message.</p> <p>Time counter will be checked elapsed time on every last click.</p> <p>I'll use this code to prevent unwanted network traffic on my site. Because, I have a calender on page; every click of calender gets too many data (event/news lists) from server. If user click too much, it may block my site.</p>
javascript jquery
[3, 5]
2,262,205
2,262,206
Update contact info on Android < 2.0
<p>I would like to get contact by name, and after that be able to check and update all information in it. Is there any example on that matter, because I couldn't find one that shows that in whole.</p> <p>tnx.</p>
java android
[1, 4]
5,237,115
5,237,116
android onclicklistener GUI change
<p>I am having a silly issue with onClickListeners modifying GUI elements. Below I have a radioGroup holding two buttons, an EditText and a Spinner. When the choose_old radio button is selected, I simply wanted to toggle enable/disable between the Spinner and EditText. The variables select_run and new_run_name are both instance variables and are obtained from my XML files.</p> <pre><code>select_run = (Spinner)runDialoglayout.findViewById(R.id.run_choice_spinner); new_run_name = (EditText)runDialoglayout.findViewById(R.id.new_run_name); RadioButton choose_old = (RadioButton)runDialoglayout.findViewById(R.id.select_old); RadioButton choose_new = (RadioButton)runDialoglayout.findViewById(R.id.select_new); choose_old.setOnClickListener(new OnClickListener(){ public void onClick(View arg0) { Log.e("ERROR","GOT CLICK"); select_run.setEnabled(true); new_run_name.setEnabled(false); } }); </code></pre> <p>The 'GOT CLICK' message prints but I do not get the desired changes. </p> <p>Note:</p> <ol> <li>In trying solutions, I had wrapped the GUI changes in a handler.post with no effect.</li> <li>If I set to enabled outside the onClickListener, it successfully changes it.</li> </ol> <p>I've no doubt this is something dumb but can't seem to figure out why this is happening</p>
java android
[1, 4]
3,892,512
3,892,513
Code Translation: ASP.NET Server.Transfer in PHP
<p>How would I do this in PHP?</p> <pre><code>Server.Transfer("/index.aspx") </code></pre> <p>(add ';' for C#)</p> <p><strong>EDIT:</strong></p> <p>It is important to have the URL remain the same as before; you know, for Google. In my situation, we have a bunch of .html files that we want to transfer and it is important to the client that the address bar doesn't change.</p>
php asp.net
[2, 9]
1,536,697
1,536,698
What is the difference between Application["Key"] and Application.Contents["Key"]?
<p><code>Application["temp"] = 8;</code> should set the value <code>8</code> to the key <code>temp</code>.</p> <p>However, so does <code>Application.Contents["temp"] = 8;</code></p> <p>So what are the differences between these two?</p> <p>Thank you very much.</p>
c# asp.net
[0, 9]
3,787,247
3,787,248
How to know which page has called the Usercontrol
<p>I have a usercontrol(.ascx) page that is used by about 10 pages to display something in common. In the control i should know which aspx page is using(or calling). How is that possible?</p> <p>Thank you in advance!</p>
c# asp.net
[0, 9]
5,926,396
5,926,397
Focus on div element
<p>I have a web page. It has too much height; in that page I have a div in the bottom of the page. I want to display the div in the center portion of the page. It’s appearing in the center of the page at the bottom position as in a way i like , but scrolling is needed. Is it possible to set focus on that div without scrolling? Does any one help me urgently?</p>
php javascript
[2, 3]
808,371
808,372
How to get different string values depending on the locale?
<p>I have an app which shows html files from assets folder. I would like to translate some files. For example I have files in folder assets/fr for french users and in assets/en for others.</p> <p>Here is the line which I want to change:</p> <pre><code>String htmlFileName = "m" + bundle.getString("defStrID") + ".html"; </code></pre> <p>So I want to get language of phone, if it's french I want to show files from /fr and if it's other show /en.</p> <p>The modified version of this line will look like</p> <pre><code>String locale = java.util.Locale.getDefault().getDisplayName(); if locale=french String htmlFileName = "m" + bundle.getString("defStrID") + ".html"; else String htmlFileName = "mn" + bundle.getString("defStrID") + ".html"; endif </code></pre> <p>Syntax is incorrect because I don't know how to do that. Help, please.</p>
java android
[1, 4]
1,194,597
1,194,598
how to chose by cliking on the button
<p>i am new to android develop , and i have that code that it should print on screen "hello" if i put in the text box "1" and "hi" if 2 , so any help will be accepted and here is the code: <a href="http://www.siz.co.il/my/zyijmfimmdj2.jpg" rel="nofollow">enter link description here</a> <a href="http://up353.siz.co.il/img2/zyijmfimmdj2.jpg" rel="nofollow">enter link description here</a> thanks for the helpers </p>
java android
[1, 4]
4,400,655
4,400,656
div to show select menu value with jquery
<p>i have a question regarding Jquery</p> <pre><code> &lt;select id="thechoices"&gt; &lt;option value="0"&gt;Select Box&lt;/option&gt; &lt;option value="box1"&gt;Box 1&lt;/option&gt; &lt;option value="box2"&gt;Box 2&lt;/option&gt; &lt;option value="box3"&gt;Box 3&lt;/option&gt; &lt;/select&gt; &lt;!-- the DIV --&gt; &lt;div id="value"&gt; disabled till you make a choice&lt;/div&gt; </code></pre> <p>while the select menu have the choice Select box i need the div to be shown as a small black screen with the disabled message once the user change the select menu and choose another option the value div shown the selected option for example Box 1 or Box 2</p>
javascript jquery
[3, 5]
1,963,640
1,963,641
JavaScript and JQuery - Encoding HTML
<p>I have a web page that has a textarea defined on it like so:</p> <pre><code>&lt;textarea id="myTextArea" rows="6" cols="75"&gt;&lt;/textarea&gt; </code></pre> <p>There is a chance that a user may enter single and double quotes in this field. For instance, I have been testing with the following string:</p> <pre><code>Just testin' using single and double "quotes". I'm hoping the end of this task is comin'. </code></pre> <p>Additionally, the user may enter HTML code, which I would prefer to prevent. Regardless, I am passing the contents of this textarea onto web service. I must encode the contents of the textarea in JavaScript before I can send it on. Currently, I'm trying the following:</p> <pre><code>var contents $('&lt;div/&gt;').text($("#myTextArea").val()).html(); alert(contents); </code></pre> <p>I was expecting contents to display</p> <pre><code>Just testin&amp;#39; using single and double &amp;#34;quotes&amp;#34;. I&amp;#39;m hoping the end of this task is comin&amp;#39;. </code></pre> <p>Instead, the original string is printed out. Beyond just double-and-single quotes, there are a variety of entities to consider. Because of this, I was assuming there would be a way to encode HTML before passing it on. Can someone please tell me how to do this?</p> <p>Thank you,</p>
javascript jquery
[3, 5]
5,771,308
5,771,309
Check if div has less than two children
<p>I've just started using jQuery, and can't get my head around this.</p> <p>I need to check if a div contains anything <em>but</em> a h3 header tag. </p> <p>The structure of the html is as follows:</p> <pre><code>&lt;div id="myContainer"&gt; &lt;h3&gt;A header that is always present&lt;/h3&gt; any html, plain text or empty &lt;/div&gt; </code></pre> <p>Here's the jQuery:</p> <pre><code>if ( $("#myContainer h3:only-child") ) { $("#myContainer").css("display", "none"); } </code></pre> <p>The above will simply hide the div if there is no other html elements present, which is not what I intend since it will also contain plain text. I have tried with other selectors and functions, but I just can't seem to get it right.</p> <p>Thanks in advance :)</p>
javascript jquery
[3, 5]
3,635,629
3,635,630
is "->" in php similar (a.k.a equivalent) to "." in javascript?
<p>In other words, php</p> <pre><code>$object-&gt;method(); </code></pre> <p>and</p> <pre><code>$object-&gt;property = 'someValue'; </code></pre> <hr> <p>is equivalent to, js:</p> <pre><code>$object.method(); </code></pre> <p>and</p> <pre><code>$object.property = 'someValue'; </code></pre> <p>I am curious, or is my php and js understanding messed up?</p>
php javascript
[2, 3]
3,039,669
3,039,670
Image tile over png php jquery
<p>I would like to know if it is possible to tile a small seamless pattern over a png image with php or jquery,</p> <p>The same as photoshop does pattern overlay,</p> <p>Thanks in advance.</p>
php javascript jquery
[2, 3, 5]
5,390,179
5,390,180
What is the $ symbol used for in JavaScript
<p>I am a JavaScript learner and have been researching this matter, but with no success. What is the <code>$</code> symbol used for in JavaScript besides regular expressions? Any resources or readings regarding this would be appreciated. <em>Thanks</em>.</p>
javascript jquery
[3, 5]
35,409
35,410
How get object from each function
<p>I have a <code>&lt;div&gt;</code> with rabioboxs:</p> <pre><code>&lt;div id='RB-01'&gt; &lt;span&gt;Item_1&lt;/span&gt;&lt;input type='radio' name='RB01' value='1'&gt;&lt;br /&gt; &lt;span&gt;Item_2&lt;/span&gt;&lt;input type='radio' name='RB01' value='2'&gt;&lt;br /&gt; &lt;span&gt;Item_3&lt;/span&gt;&lt;input type='radio' name='RB01' value='3'&gt;&lt;br /&gt; &lt;/div&gt; </code></pre> <p>Then with jquery I want to get a radiobox that was checked:</p> <pre><code>var obj = null; var tempId = "RB-01"; if ($('div[id=' + tempId + ']')) { $('div[id=' + tempId + '] input').each(function() { if ($(this).checked == true) { obj = $(this); } }); } </code></pre> <p>but in the end obj = null.</p>
javascript jquery
[3, 5]
757,761
757,762
What is a good resource for help on codes to use for App?
<p>I am a novice programmer when it comes to Java, I have Java:How To Program 7th Ed. that I am reading. My major is Computer Science so I have a little bit of knowledge about what yo do but as for the Application. I am trying to make a game app and was wandering what would be a good source to reference for various things inside of the app mainly the game play. </p>
java android
[1, 4]
5,245,271
5,245,272
How to push cursor to the next line when user hits ctrl + enter?
<p>I'm working on a textarea, where if the user hits enter, it causes the form to submit, but if he hits ctrl + enter, I want it to move to the next line.</p> <p>This is the code that I'm using, within my function which is called on keypress by jquery:</p> <pre><code>if ( (e.keyCode == 10 || e.keyCode == 13) &amp;&amp; e.ctrlKey) //move to next line here </code></pre> <p>Any ideas how to do this?</p>
javascript jquery
[3, 5]
5,037,150
5,037,151
Javascript execute timer function only if window is in focus?
<p>Say I have two separate browser windows open:</p> <pre><code>function onload() { setTimeout("dosomething", 2000); } function dosomething() { $.ajax({ url: "someurl", success: function (data) { document.write("Hello"); } }); setTimeout("dosomething", 2000); } </code></pre> <p>I want to make it so that hello is printed every two seconds only when the window is in focus. If the window is not in focus, then the timer would essentially pause (in other words, timer would stop ticking, dosomething would not be called) until the user clicks on the browser window that is not in focus, which the timer would resume and the Hello words would continue to be printed, while the other window would stop timer, vice versa.</p> <p>How do I accomplish this?</p>
javascript jquery
[3, 5]
347,661
347,662
Jquery - hover event disappears after mousedown event is triggered.
<p>Have an issue with a jquery script. Page loads with the script below. The hover event works fine. However, if the mousedown event fires, the hover event functionality subsequently disappears and I don't get any rollovers. Any ideas as to why and how to keep the hover event firing off each and every time? Viewing the page in IE.</p> <pre><code>// Rollover effect for sign. $("#sign").hover(function () { $("#sign").css('background', 'url(img/default/signinon.png) no-repeat 0 0'); }, function () { $("#sign").css('background', 'url(img/default/signin.png) no-repeat 0 0'); }); //Mousedown function... $(document).mousedown(function (event) { var $target = $(event.target); // A click outside of the sign in panel or a click on the sign in button when the body panel is visible, hides the display. if ((!$target.is('#sign') &amp;&amp; !$target.is('#sign-in-panel') &amp;&amp; !$target.parents().is('#sign-in-panel') &amp;&amp; !$target.parents().is('#sign')) || ($target.is('#sign') &amp;&amp; $("#sign-in-panel").css('visibility') == 'visible')) { $("#sign-in-panel").css('visibility', 'hidden'); $("#sign").css('background', 'url(img/default/signin.png) no-repeat 0 0'); } else { // Show the panel $("#sign-in-panel").css('visibility', 'visible'); } }); </code></pre>
javascript jquery
[3, 5]
2,361,876
2,361,877
Jquery - Accessing nested child elements
<p>Assume I have the following HTML - </p> <pre><code>&lt;DIV id="ParentDiv"&gt; &lt;DIV id="SubDiv1"&gt;&lt;/DIV&gt; &lt;DIV id="SubDiv2"&gt; &lt;INPUT id="input"&gt; &lt;/DIV&gt; &lt;/DIV&gt; </code></pre> <p>To access the input element using jquery, it would be simply $("#input"). What I'm trying to do is access it, assuming I only know the ID of the top level div. </p> <p>Currently I have </p> <pre><code>$($($("#ParentDiv").children()[1]).children()[0]) </code></pre> <p>Which does seem to work. Is there a cleaner way of writing this, or is the way I am doing it ok?</p>
javascript jquery
[3, 5]
3,299,840
3,299,841
want to show / hide only the specified elements in jQuery iteration
<p>I have the following code where I want to show / hide different text based upon a mouseover. I am using a data-global-id value and want to iterate through the children of the item-list and hide all but specified value (item-1 for data-global-id=1 for example): </p> <pre><code>&lt;script&gt; $(document).ready(function() { $('.item-list').hide(); $('.h').mouseover(function() { // need to hide everything but the 1 or 2 var id = $(this).data('global-id'); var chil=$('.item-list').children(); $.each(chil, function(i,v){ alert(i); console.log(v); }); }); }); &lt;/script&gt; &lt;style&gt; .h{ width: 200px; border: 1px solid red; } &lt;/style&gt; &lt;ul&gt; &lt;li&gt;&lt;div class='h' data-global-id="1"&gt;Client 1&lt;/div&gt;&lt;/li&gt; &lt;li&gt;&lt;div class='h' data-global-id="2"&gt;Client 2&lt;/div&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul class="item-list"&gt; &lt;li class="item-1"&gt; Lorem ipsum jtjtjt, etc... &lt;/li&gt; &lt;li class="item-2"&gt; Lorem ipsum, etc... &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>How would I specify in the each loop to hide everything and just show the item+data-global-id value? Is there a better / easier way to do this?</p> <p>thx</p>
javascript jquery
[3, 5]
2,273,729
2,273,730
convert a web page as image using jquery, PHP or javascript
<p>I need to convert a web page into image using PHP, Jquery or Javascript for my web application developing in PHP.</p>
php jquery
[2, 5]
3,425,260
3,425,261
jQuery tool tip on hover
<p>I am in need of a very lightweight tooltip similar to the 1 found here <a href="http://www.history.com/videos" rel="nofollow">http://www.history.com/videos</a> when you hover a video link under "Popular Videos", a tooltip fades into place, it stays there and you can even select text on it until you move the cursor off it. Facebook and Google+ also have a similar style tool-tip as well as stackoverflow when you hover over a tag. Can someone provide a light weight method of doing this. </p> <p>I have search and looked at many existing "plugins" they are all somewhat bloated though. Thanks for any help</p>
javascript jquery
[3, 5]
2,411,522
2,411,523
jquery count the elements by class and set the another class a certain element in the list
<p>How with jQuery/Javascript count the elements by class and set another class a certain element in the list.</p> <p>It is possible?</p> <p>An example, i have four elements with the class "qa" and change or add class "qa2" second element in list.</p>
javascript jquery
[3, 5]
2,023,964
2,023,965
send commands to a backgrounded jobs stdin
<p>I have a java server application that, when its running, you can interact with it sending commands via stdin. I want to write a web interface that can send these commands to it. </p> <p>In order to do that I need some way of getting commands from php to the stdin for this backgrounded job. Is there a way to do this from console? or possibly write some kind of wrapper that controls the server job and can access its stdin ? could this be done in python?</p>
php python
[2, 7]
4,722,722
4,722,723
dynamic google pie chart in jquery php
<p>I am creating google piecharts but here I have to used iframe to show this chart, but I want to show it by ajax and without iframe.... Is there any way to show google piechart without iframe??</p>
php jquery
[2, 5]
5,477,230
5,477,231
javascript associative array access by key value
<p>I have an array like this:</p> <pre><code>employees = [ { "id": 1, "shift_id": 1, "days": { "2012-03-01": 1, "2012-03-02": 1, "2012-03-03": 1, "2012-03-04": 0, "2012-03-05": 0, "2012-03-06": 0 }}, { "id": 2, "shift_id": 1, "days": { "2012-03-01": 0, "2012-03-02": 1, "2012-03-03": 1, "2012-03-04": 1, "2012-03-05": 1, "2012-03-06": 0 }}, { "id": 3, "shift_id": 2, "days": { "2012-03-01": 0, "2012-03-02": 0, "2012-03-03": 1, "2012-03-04": 1, "2012-03-05": 1, "2012-03-06": 1 }} ]; </code></pre> <p>is there a way to access an element in this array using the id value? maybe something in jquery? like <code>$(employees('id = 1');</code></p>
javascript jquery
[3, 5]
1,754,704
1,754,705
Is there a way to modify a startup script previously registered with RegisterStartupScript?
<p>I have a control that must emit a javascript array of data, which is accumulated throughout the page lifecycle.</p> <p>The control does not know when the data is finished being accumulated, so there is no single point where it knows when to call <code>RegisterStartupScript</code>.</p> <p>How do I accomplish this then? My original plan was to call <code>RegisterStartupScript</code> each time data is added, but with the same <code>key</code>, only the first call will render anything.</p> <p>So, perhaps a better question title is something like "How do I know when to call RegisterStartupScript when the script can change throughout the page lifecycle?"</p>
javascript asp.net
[3, 9]
205,440
205,441
get query string into js/jquery
<p>i hae a link like ( domain.com/jsapi?key=123456 )</p> <p>hov can i get this "key" into my JS code? i use jQuery and i don't know about its are easy way to get this "key" into JS variable.</p> <p>tanks for all.</p>
javascript jquery
[3, 5]
4,557,031
4,557,032
jQuery function not working with data that has been loaded with Ajax
<p>When user clicks a link, it runs <code>$.post</code> to retrieve some data and display it. One of the links pulls a table of sessions with a button next to every session. Here is the code for one of the buttons:</p> <pre><code>&lt;button class="view_session btn btn-info" id="3f87d50493698d06b9b48abe36cd8fc8"&gt;Details&lt;/button&gt; </code></pre> <p>And here is my jQuery function:</p> <pre><code>$('.view_session').click(function(){ $('#blanket').show(); $('#load').show(); $.post("admin/session.php", { id: $(this).attr('id') }, function(data){ $('#sort').html(data); $('#first').hide(); $('#load').hide(); $('#blanket').hide(); }); }); </code></pre> <p>But nothing happens. I put in a <code>Console.log</code> to test and nothing triggered. Is there something I have to do because the button is being created after the page loads initially?</p>
php javascript jquery
[2, 3, 5]
287,378
287,379
how to convert char to int in java for android
<p>how to convert char to int in java for android</p> <p>for example: </p> <pre><code>int MyInt; char MyChar = 'A'; </code></pre> <p>how to insert the value 65 into MyInt ?</p> <p>in C# it like: <code>MyInt = Convert.ToChar(MyChar);</code> </p> <p>thanks</p>
java android
[1, 4]
42,325
42,326
jQuery function to check if an email address exists
<p>I have a very limited jQuery experience and I was wondering if you can help me with a function that has to check, with an AJAX request, if an email address exists or not. </p> <p>Until now I have this piece of code for email checking:</p> <pre><code>$('input#email').bind('blur', function(){ $.ajax({ url: 'ajax/email.php', type: 'GET', data: 'email=' + $('input#email').val(), cache: false, success: function(html) { if (html == 1) alert('Email exists!'); } }); }); </code></pre> <p>How can I make a function out of this and use it like this:</p> <pre><code>if (!email_exists($('input#email').val())) { $('#error_email').text('Email exists').show(); return false; } </code></pre> <p>My PHP code looks like this:</p> <pre><code>$email = ($_GET['email']) ? $_GET['email'] : $_POST['email']; $query = "SELECT `id` FROM `users` \n" . "WHERE `users`.`email` = '".mysql_real_escape_string($email)."'"; $result = mysql_query($query); if (mysql_num_rows($result) &gt; 0) { echo '1'; } else { echo '0'; } </code></pre> <p>Thank you.</p>
php jquery
[2, 5]
5,050,436
5,050,437
checkbox filtering system
<p>I came across this page at <a href="http://www.walmart.com/browse/Computers/Desktop-Computers/_/N-96fg?browsein=true&amp;catNavId=3951&amp;ic=48_0&amp;ref=%20428236" rel="nofollow">walmart.com</a> and on the left side of the page is a checkbox filtering system that is done on the client side. When you check the price checkbox selection it filters out the brands and disables enables/disables them etc.</p> <p>When i had a look at the source code the checkboxes have no values and when i tried to find the <code>REFINEMENT.clicked</code> event I couldn't find it when I downloaded the page. It's a very big page with lots of code and would prob take a long time to go through it.</p> <p>I was wondering how could I implement this filtering system in jquery for the client side. You could use a array that stores values but how would i know which properties the filters have as each page would show different filters (other than price range) based upon the product type.</p> <p>If someone could point me in the right direction or give an example as to what to do that would help.</p>
javascript jquery
[3, 5]
2,397,137
2,397,138
How can I combine an image slider with scaling images?
<p>I have a bit of a dilemma in the sense that I can't seem to get a jquery image cycler working with scaling images.</p> <p>What I basically have is a website with a small navigation list at the top, and then full screen images which can be cycled using a control at the bottom of the page. Previously I've used <a href="http://srobbin.com/jquery-plugins/backstretch/" rel="nofollow">backstretch</a> to get the desired effect for a background image that stretches with the browser window.</p> <p>I was also hoping on using <a href="http://jquery.malsup.com/cycle/" rel="nofollow">Jquery Cycle</a> as the plugin to do the image slider (as I've used this countless times before).</p> <p>The problem is that I need the effect of backstretch (ie. scaling images) but with a slider. I have tried using other plugins for the stretching but most of them only seem to allow the images to be scaled down (if the window shrinks) rather than upwards. I can't use backstretch because it takes up the entire body tag. I only need a container div to contain the stretched images (so I can have the header/navigation sitting at the top without cropping the images).</p> <p>However I have no idea how to then get this to work with Jquery Cycle.</p> <p>Has anyone done this before or have any examples of this working?</p> <p>Thanks</p>
javascript jquery
[3, 5]
182,938
182,939
url.contains, url.startsWith, Other examples?
<p>Well it is hard to explain, I searched the internet for the answer, unfortunately I can't find any, maybe because I don't know what is it called though.</p> <p>It's like url.CONTAINS url.STARTSWITH</p> <p>What's the capitalized thing called? Class? Object? Plus, if it's possible if I can get a list of things to put after url."Class/Object/Whatever it is called".</p>
java android
[1, 4]
3,732,636
3,732,637
jQuery: alternative way to do this with substr()
<p>I'm working on a codecademy exercise where we're building a hangman game with jQuery/JavaScript. The player starts with a string of underline characters '<strong><em></strong>' and if they guess a letter in the word, the appropriate underline should be replaced with that letter. For example, if the word is 'tree' and the player guesses 'e', the function should return '</em>_ee'</p> <p>I wrote the function using gsub. N is the position where the string is supposed to be alterned, and c is the character to insert at that position on the original string. This passes the test at codecademy. </p> <pre><code>function alterAt ( n, c, originalString ) { var k = originalString.gsub(n, c ); return k; } </code></pre> <p>However, codecademy told me to use the function substr() and concatenation to return a new string with the letter replaced. I can't figure out how to do it this way, and I'm not even sure if it's the better way to do it. What's wrong with using gsub? Can you assist? </p>
javascript jquery
[3, 5]
2,572,409
2,572,410
StartsWith in Expression return null
<p>Could somone tell me why this statement return nothing and how to correct it. What im trying todo is select User where username starts with the letter from the alphabet</p> <p>alpha = "A" "B" "C" "D" etc. both don't work</p> <pre><code>IList&lt;MembershipUser&gt; users = Membership.GetAllUsers().Cast&lt;MembershipUser&gt;() .Where(x =&gt; x.UserName.StartsWith(alpha) == true).ToList(); IList&lt;MembershipUser&gt; users = Membership.GetAllUsers().Cast&lt;MembershipUser&gt;() .Where(x =&gt; x.UserName.StartsWith(alpha)).ToList(); </code></pre>
c# asp.net
[0, 9]
1,338,566
1,338,567
$.post syntax in jQuery
<p>Please let me know if below is the correct way to send data to another page using jQuery or not. I am a beginner and not sure about the syntax. <code>rowData</code> is in JSON format. I am passing the values on click of a button.</p> <pre><code>$.post("GridValues.jsp", {"rowData": rowData }); </code></pre>
javascript jquery
[3, 5]
5,900,585
5,900,586
jQuery - Combining multiple element selectors with :not - how
<p>I am having a devil of a time getting two selectors to work <em>together</em> as well as do when I declared seperate.</p> <p>My issue:</p> <p>I want to close a menu when I move to <em>any</em> input OR anchor tag that is NOT contained with a certain element. When I explicitly code for both input and anchor, I get the behavior I need - BUT when I try to condense my code and combine them, it behaves weirdly and does not work as intended.</p> <p>So, basically when a user focus's in an input field or anchor that is NOT a child of my selector I want to close a menu. When I use two sperate handlers, it works. I want to combine them. </p> <p>I am trying to shorten this....</p> <pre><code>jQuery('#hdr input:not(#opt *)') .focusin(function(event){ setTimeout(function(){ jQuery("#opt").hide() },100); }); jQuery('#hdr a:not(#opt *)') .focusin(function(event){ setTimeout(function(){ jQuery("#opt").hide(); },100); }); </code></pre> <p>I've tried all of this into one line, to no avail:</p> <pre><code>jQuery('#hdr a input:not(#opt *)') jQuery('#hdr a, #hdr input:not(#opt *)') &lt;-- I expect this to work, but doesn't. jQuery('#hdr a,input:not(#opt *)') jQuery('#hdr *:not(#opt *)') </code></pre> <p>It seems to only work when I do a single arg like: #hdr a , or #hdr input BUT when I try to combine them, no luck. I've searched high and low but no luck.</p>
javascript jquery
[3, 5]
2,810,564
2,810,565
Coda slider does not increse height in run time
<p>I used coda slider version 2.0. It automatically resizes the height for each tab. The problem is, the main panel height is varied at run time. But it does not take the new height. The standard height is reflected. Here is the code in coda slider for assigning a height. </p> <pre><code>if (settings.autoHeight) { panelHeight = $('.panel:eq(' + (currentPanel - 1) + ')', slider).height(); slider.css({ height: panelHeight }); }; </code></pre> <p>Initially Im having the page like this,<img src="http://i.stack.imgur.com/pTxUq.jpg" alt="enter image description here"></p> <p>If i increase the number of rows in table using jquery, the part of the section will be hide like below,<img src="http://i.stack.imgur.com/nHxs9.jpg" alt="enter image description here"></p>
javascript jquery
[3, 5]
607,701
607,702
Web.Config <appSettings file=""> question
<p>I have defined in my web.config the following:</p> <pre><code>&lt;appSettings file="settings.config" &gt; &lt;/appSettings&gt; </code></pre> <p>It works just fine, but my question is, how to i modify it at runtime?</p> <p>If i use:</p> <pre><code>WebConfigurationManager.OpenWebConfiguration("~/"); </code></pre> <p>This actually modifies my web.config.</p> <p>I have a few entries in my custom configuration file i would like to edit.</p> <p>Any thoughts or pointers would be greatly appreciated :)</p>
c# asp.net
[0, 9]
5,450,918
5,450,919
Link to anchor (ajax url) doesn't call onBeforeUnload
<p>I have an onbeforeunload event :</p> <pre><code>$().ready(function() { window.onbeforeunload=function() { return "haha" }; }); </code></pre> <p>And my links are like this (ajax web site) :</p> <pre><code>&lt;a href="#pageX" /&gt; </code></pre> <p>But the onbeforeunload is never called. What can i do ?</p> <p>Thanks</p>
javascript jquery
[3, 5]
1,943,600
1,943,601
How to call a java script function from code behind some button click condition?
<p>i want to open a model pop up on some button click in code behind which has got a few if else condition. First of all i am unable to fix what would be best approach. What i options i think are followign. 1) calling a jquery model pop up 2) ajax model pop up</p> <p>It is a button which fix on some button click condition to open the model pop up, if model pop says yes then, i want client to rediret to some payemnt page where he will pay to purchase the item.</p> <p>Right now i am using the Jquery model pop up which i am calling like this</p> <pre><code> protected void imgClientFreeEval_Click(object sender, System.Web.UI.ImageClickEventArgs e) { ----- ---some code not typed if (SurveyCount &gt; 1) { Session["YourAssessment"] = true; Session["MyAssessment"] = false; ScriptManager.RegisterStartupScript(this, this.GetType(), "tmp", "&lt;script&gt;xyz()&lt;/script&gt;", true); //Response.Redirect("~/yourAssessment.aspx"); } } </code></pre> <p>and i have model pop up like this</p> <pre><code> function xyz() { // alert('hi tpo all'); // a workaround for a flaw in the demo system (http://dev.jqueryui.com/ticket/4375), ignore! // $("#dialog:ui-dialog").dialog("destroy"); $(document).ready(function () { $("#dialog-confirm").dialog({ resizable: false, height: 140, modal: true, autoOpen: false, buttons: { "OK": function () { $(this).dialog("close"); window.location.replace("http://stackoverflow.com"); }, Cancel: function () { window.location.replace("http://stackoverflow.com"); $(this).dialog("close"); } } }); }); } </code></pre> <p>Now the problem is that this function not getting called at all. what is wrong with this, i am toiling for long, if possible please suggest me best approach how should i execute it. i am unable to call this javasccipt function from code behind button click.</p>
javascript jquery asp.net
[3, 5, 9]
1,723,009
1,723,010
Hide/show text box using jQuery
<p>I am using jquery for the first time ,so please help me out here. I've searched a lot but haven't found the answer to my question. I want it so that the text box is visible if the score value is not blank and for it to be hidden when the score value is null. The score value is inserted in the input field. Thanks in advance. This is my current code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $('#click').raty({ click: function(score) { //alert(score); } }); }); &lt;/script&gt; &lt;div class="inputs"&gt; &lt;div id="click"&gt;&lt;/div&gt; &lt;input type="text" name="type" id="type" style="display:none;" value="" /&gt; &lt;/div&gt; </code></pre>
php javascript jquery
[2, 3, 5]
603,169
603,170
I need pass by reference please
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/40480/is-java-pass-by-reference">Is Java pass by reference?</a> </p> </blockquote> <p>As I understand it, in Java there is no pass by reference, always pass by value. Does this mean that an object passed as an argument will be copied, everytime? Or is this some sort of pass by value but Java isn't so stupid that it copies the entire object?</p> <p>I'm working on a fairly dense OpenGL project on Android. And the object holding all the scene data is not exactly small in size. That object is passed down from one function to another. So basically, if Java has no pass by reference it will be many copies of a big object.</p>
java android
[1, 4]
1,662,763
1,662,764
Smartphone Development Framework & Platform?
<p>I am a C Sharp.NET &amp; Silverlight developer and now thinking to swicth to SmartDevice development specially for iPhone &amp; Andriod based phones. I have looked over web and found some cross platform development frameworks like </p> <pre><code>http://developer.openplug.com http://www.phonegap.com/ http://android.xamarin.com/Welcome </code></pre> <p>but not sure about which to choose. Naturally I would like to keep my learning curve less but also would like to choose platform which provides more power, so I am looking for your suggestions and 'Getting Started' tips and also which device you think will be in demand in future iPhone or Android ? .</p> <p>Thanks, Maverick</p>
iphone android
[8, 4]
1,970,893
1,970,894
Start function with both mousewheel and click jQuery
<pre><code>$('.div').bind('mousewheel', function(e, delta) { </code></pre> <p>How do I write if I also want a single click to start the function? I want the user to be able to choose himself.</p> <p>Thanks!</p>
javascript jquery
[3, 5]
3,213,185
3,213,186
jquery questionnaire
<p>I am trying to create a jquery questionnaire but my little jquery knowledge doesn't help me.</p> <p>What I have until now is the following <a href="http://valogiannis.com/stackoverflow/quest.html" rel="nofollow">http://valogiannis.com/stackoverflow/quest.html</a></p> <p>When you click Questions a popup open with two questions.</p> <p>I want the following: when the user click one of the two answer, the script check his answer. The array CheckFirstAnswer is responsible to "tell" if the first answer is wrong or correct, 0 for wrong, 1 for correct. If user click the correct answer then I want to appear the next question with its answers from the arrays Question,FirstAnswer,SecondAnswer otherwise the corresponding Conclusion proportionately the i value.</p> <p>I would appreciate any help.</p> <p>Thanks</p>
javascript jquery
[3, 5]
4,553,593
4,553,594
How to pass text from activity to another?
<p>I want on the first Activity (in the layout to write) what is your name?! when a person write his name when he movie to anther Activity it should appear Hello(THE NAME)! how should i do this?</p>
java android
[1, 4]
3,219,311
3,219,312
Calling a method from within a class - not working
<p>So I've got a class, commenter, and two methods within that class, SaveBtn_Click - created primarily not by me, and then also PeerReview, primarily created by me.</p> <p>Anyway, the code starts off like this (after a variety of using statements):</p> <pre><code>public partial class commenter : System.Web.UI.Page { string employee_reviewed; PeerReview pr = new PeerReview(); public void SaveBtn_Click(object sender, EventArgs e) { //all the information for the SaveBtn_Click method. } </code></pre> <p>After that, I have PeerReview:</p> <pre><code> public void PeerReview(System.Web.UI.WebControls.ListBox listbox) { MySqlConnection con = new MySqlConnection("server=localhost;database=hourtracking;uid=username;password=password"); MySqlCommand cmd = new MySqlCommand("select first_name from employee where active_status=1", con); con.Open(); MySqlDataReader r = cmd.ExecuteReader(); Console.WriteLine("Another test!"); Console.WriteLine(r); Console.WriteLine("Hi, this is a test!"); while (r.Read()) { listbox.Items.Add(new ListItem(Convert.ToString(r["first_name"]), Convert.ToString(r["first_name"]))); } con.Close(); } </code></pre> <p>I'm connecting this with ASP.NET, and I can get the listbox to show up, but not the individual items in the listbox. I'm testing it with a console.writeline command, to see if that outputs anything - but nothing is being put out on the ASP page.</p> <p>I'm not certain how I should reference these particular sections (new to C#, asking like 3 dozen questions about this).</p> <p>ASP code looks like this:</p> <pre><code>&lt;asp:ListBox ID="listBox1" runat="server"&gt; </code></pre> <p></p>
c# asp.net
[0, 9]
1,896,342
1,896,343
Does jQuery's .load() always automatically execute scripts?
<p>I noticed if you <code>.load(url)</code> and the url is a page that contains scripts, those scripts are automatically executed. Is there a way to call <code>.load(url)</code> without the scripts executing, then perhaps execute them later? They seem to execute even if I've used <code>.load(url)</code> on an element that hasn't been appended to the document.</p>
javascript jquery
[3, 5]
3,541,351
3,541,352
Php Validation for TextArea Number of Lines Limitation
<p>I have this wonderful piece of code from <a href="http://stackoverflow.com/questions/556767/limiting-number-of-lines-in-textarea?rq=1">here</a></p> <p>But if some one edits the form through firebug or disable the js then this wont work, I want to have server side validation for this function, can anyone direct me to the right path please</p>
php jquery
[2, 5]
425,735
425,736
How do I make sure a URL is an image using JavaScript + jQuery?
<p>In my web application, users can post text to a feed, and the text may include URL's. My code scans for URL's and replaces them which anchor tags pointed at the URL's. I want to change this so that my code can detect whether or not the URL points to an image, and if it does, render an image tag inside the anchor tag, instead of just the URL text.</p> <p>I can do this on server side code by sending a quick 'HEAD' request to the URL to see what the Content-Type is on the response, and this works reliably. However, it doesn't scale well for obvious reasons.</p> <p>What would be better is if I could push this logic onto the client's browser. I'd like to use JavaScript + jQuery to send the 'HEAD' request to the specified URL, and read the Content-Type header from the response.</p> <p>I know that cross-domain requests are an issue. Could I somehow use JSONP? What options do I have?</p> <h1>EDIT - SECURITY RISK</h1> <p>I got some good answers to my question, but I wanted to point out something in big bold letters. As Adam pointed out in the comments, this is a security risk. If you can guarantee the URL's of the images are all coming from trusted domains, you're good to go with this solution. However, in my scenario, users can enter whatever URL they want. This means they could create their own site which requires basic authentication, and then when the jQuery runs to set the src attribute on the created image, the user is presented with a username/password dialog, and that's obviously a <strong>huge</strong> risk.</p>
javascript jquery
[3, 5]
2,728,253
2,728,254
Div onclick event not called in Mozilla
<p>I have this in my code:</p> <pre><code>&lt;div class="someClass"&gt; &lt;div id="22" class="otherClass" onclick="goToEdit();"&gt;Title&lt;/div&gt; &lt;div class="parent"&gt;Other title&lt;/div&gt; &lt;/div&gt; </code></pre> <p>And:</p> <pre><code>function goToEdit() { tree.selectItem($(event.target).attr('id')); btnMyButton_onclick(); } </code></pre> <p>In Chrome everything works fine, but in Mozilla it doesn't react to the click event. Why?</p>
javascript jquery
[3, 5]
2,501,680
2,501,681
Variable as jQuery selector focus
<p>I'm using JavaScript to copy a specific div from a page into a new page. I need to remove the ID attributes for each table in the new page.</p> <p>It seems that since I'm copying content from the first page, I can filter out the IDs from the string before it is written to the second page. Can jQuery take a variable as its 'focus'? Instead of manipulating the entire DOM, manipulate a particular string?</p> <p>I have a non-working version of what I'm talking about:</p> <pre><code>var currentContent = window.open('','currentContentWindow'); var htmlToCopy = '&lt;html&gt;&lt;head&gt;&lt;title&gt;&lt;/title&gt;&lt;/head&gt;&lt;body&gt;' + window.frames[0].document.getElementById('PageContentPane').innerHTML + '&lt;/body&gt;&lt;/html&gt;'; $("table", htmlToCopy).removeAttr('id'); currentContent.document.open(); currentContent.document.write(htmlToCopy); currentContent.document.close(); </code></pre>
javascript jquery
[3, 5]
3,378,613
3,378,614
Converting ISO 8601 Date in format "YYYY-MM-DDT12:00:00.000Z" to "DD.MM.YYYY" using jQuery function?
<p>I'm developing a Backbone application and from REST API data, I'm getting the date which Mongo generated in ISO format <strong>YYYY-MM-DDT12:00:00.000Z</strong>. To display in human readable in front-end view (jqgrid colmodel) table grid view, I need to show users a simple format <strong>DD.MM.YYYY</strong>. The condition is, I need to convert the date by converting only the view of the backend date to this new format.</p> <p>Any ideas?</p>
javascript jquery
[3, 5]
1,636,311
1,636,312
jquery addClass has no effect
<p>I have this html:</p> <pre><code>&lt;div class="container"&gt; &lt;div id="cell1" class="cell"&gt;&lt;div class="content"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div id="cell2" class="cell"&gt;&lt;div class="content"&gt;&lt;/div&gt;&lt;/div&gt; &lt;div id="cell3" class="cell"&gt;&lt;div class="content"&gt;&lt;/div&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>CSS:</p> <pre><code>.container { width: 300px; height: 300px; background-color: green; } .cell { background-color: red; } #cell1 { width: 70px; height: 70px; } #cell2 { width: 70px; height: 70px; } #cell3 { width: 70px; height: 70px; } .white { background-color: white; } .yellow { background-color: yellow; } .content { width:40px; height:40px; background-color:blue; } </code></pre> <p>Javascript:</p> <pre><code>$(document).on('click', '.cell', function(e) { $(this).parent().children().removeClass('white'); $(this).parent().children().children().removeClass('yellow'); $(this).addClass('white'); $(this).find('.content').addClass('yellow'); }); </code></pre> <p>The problem I am having now is addClass('yellow') has no effect. However, if I delete the background-color in content class, it works. Any thoughts why?</p> <p>jsFiddle link: <a href="http://jsfiddle.net/rexwang/FWh6E/" rel="nofollow">http://jsfiddle.net/rexwang/FWh6E/</a></p> <p>Thanks for the answers, it works! But I really don't like using addClass and removeClass, is it posible to use e.currentTarget.id to achieve the same goal? </p>
javascript jquery
[3, 5]
4,891,287
4,891,288
Google Maps add Location
<p>How can I get the location that the user has clicked on the map via js?</p>
php javascript
[2, 3]
267,710
267,711
Gridview break Literal field into multi line
<p>I have a gridview with this field:</p> <pre><code>&lt;asp:TemplateField HeaderText="Title"&gt; &lt;ItemTemplate&gt; &lt;asp:Literal ID="lblTitle" runat="server" Text='&lt;%# Eval("Title") %&gt;' /&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>If the title is too long it completely breaks the gridview. How can I: </p> <ol> <li>Make the width of this column fixed.</li> <li>If the content is too long, break it into multi lines.</li> </ol>
c# asp.net
[0, 9]
2,459,856
2,459,857
How to get result of POST method `$.post()`?
<p>I use the following code to POST data:</p> <pre><code>$.post("http://domain/page.aspx", postdata); </code></pre> <p><strong>UPDATED:</strong></p> <p>The following code doesn't work:</p> <pre><code>$.post("http://domain/page.aspx", postdata, function(data){alert(data);}); </code></pre> <p>How to get server response as string?</p>
javascript jquery
[3, 5]