Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
5,627,686
5,627,687
parsing css measures
<p>When i write a jQuery plugin i like to specify options for spacings the CSS way. I wrote a function that returns a CSS String as values in a object. </p> <p>5px 10px returns top: 5px, right: 10px, bottom: 5px, left: 10px</p> <p>Now i often use the returned values to do some calculations and its not very nice to have to extract the measuring unit every time...</p> <p>I suck in writing regular expressions could someone help me complete this function:</p> <pre><code>this.cssMeasure = function(cssString, separateUnits){ if ( cssString ){ var values = {} }else{ return errorMsg } var spacing = cssString.split(' ') var errorMsg = 'please format your css values correctly dude' if( spacing[4] ) { return errorMsg } else if ( spacing[3] ) { values = {top: spacing[0], right:spacing[1], bottom:spacing[2], left:spacing[3]} } else if ( spacing[2] ) { values = {top: spacing[0], right:spacing[1], bottom:spacing[2], left:spacing[1]} } else if ( spacing[1] ) { values = {top: spacing[0], right:spacing[1], bottom:spacing[0], left:spacing[1]} } else { values = {top: spacing[0], right:spacing[0], bottom:spacing[0], left:spacing[0]} } if (separateUnits) { $.each(values, function(i, value){ /* at this place i need to extract the measuring unit of each value and return them separately something like top: {value: 10, unit: 'px'}, right: {bla} and so on */ }) } return values } </code></pre> <p>if you have any idea how to improve this function i am open to your comments.</p>
javascript jquery
[3, 5]
1,033,634
1,033,635
how to show textarea based on select dropdown using jquery?
<p>i want to display 2x dropdown menus both will be pre populated (2nd menu "mainToon" will contain over 200 names but for the example i have shown just a few.</p> <pre><code>&lt;select id="category" name="Category"&gt; &lt;option value=" "&gt;&lt;/option&gt; &lt;option value=" "&gt;-----------------&lt;/option&gt; &lt;option value="Main Toon"&gt;Main Toon&lt;/option&gt; &lt;option value="Alt Toon"&gt;Alt Toon&lt;/option&gt; &lt;option value="Cyno Toon"&gt;Cyno Toon&lt;/option&gt; &lt;option value="Super Toon"&gt;Super Toon&lt;/option&gt; &lt;option value="Dust Toon"&gt;Dust Toon&lt;/option&gt; &lt;/select&gt; &lt;select id="mainToon" name="mainToon"&gt; &lt;option value=" "&gt;&lt;/option&gt; &lt;option value=" "&gt;-----------------&lt;/option&gt; &lt;option value="Agmar"&gt;Agmar&lt;/option&gt; &lt;option value="S Tein"&gt;S Tein&lt;/option&gt; &lt;option value="Karades"&gt;Karades&lt;/option&gt; &lt;option value="Bad Kharma"&gt;Bad Kharma&lt;/option&gt; &lt;option value="Ed jeni"&gt;Ed Jeni&lt;/option&gt; &lt;/select&gt; </code></pre> <p>by default the first dropdown will show blank and i want the "mainToon" dropdown to be hidden untill any of the following are selected:</p> <p>"Alt Toon", "Cyno Toon", "Super Toon", "Dust Toon"</p> <p>Then the form will be visable.</p> <p>Can i do this by applying a .hidden css code to the dropdown and changing the class dynamically when other options are selected?</p> <p>many thanks for the help.</p>
php jquery
[2, 5]
2,384,200
2,384,201
ASPx set Cookie Domain
<p>I have a code as follows:</p> <pre><code> this.Response.Cookies.Add(new HttpCookie("COOKIENAME",'test')); </code></pre> <p>I want to add the domain ".test.com" for this cookie. How do I do so? I tried the standard:</p> <pre><code> this.Response.Cookies["COOKIENAME"].Domain = ".test.co.uk"; </code></pre> <p>But the cookie is not being set for the whole domain. Any suggestions?</p> <p>The following is not working either:</p> <pre><code>HttpCookie MyCookie = new HttpCookie("COOKIENAME"); MyCookie.Value = 'test'; MyCookie.Domain = ".test.co.uk"; this.Response.Cookies.Add(MyCookie); </code></pre>
c# asp.net
[0, 9]
5,569,272
5,569,273
Find out the post data size in byte
<p>When I submits the form in php. I want to find the size of the data for each text box that are posted through javascript in bytes. </p>
php javascript
[2, 3]
2,361,793
2,361,794
Menu and Submenu not behaving as expected when hovering erratically
<p>I have a horizontal menu (set out as a list) and when you hover over one of the list items it animates a dropmenu which is a child of the list item.</p> <p>This works fine if you move the cursor over the menu at a "normal" speed. The problem I have is the behaviour of the menu if you erratically move the cursor over the menu. It leaves previously hovered elements shown still and I have to hover over and out of the dropMenu until they all return to their initial state (height:0). </p> <p>My jquery for the menu is below:</p> <pre><code>$('#templateNav &gt; ul &gt; li').bind({ mouseenter: function() { $(this).find(".dropMenu").clearQueue().animate({ height: 250 }, 200); }, mouseleave: function() { $(this).find(".dropMenu").clearQueue().height(0); } }); </code></pre> <p>And here's an example of my menu code:</p> <pre><code>&lt;div id='templateNav'&gt; &lt;ul&gt; &lt;li&gt;Menu 1&lt;span class='dropMenu'&gt;...&lt;/span&gt;&lt;/li&gt; &lt;li&gt;Menu 2&lt;span class='dropMenu'&gt;...&lt;/span&gt;&lt;/li&gt; &lt;li&gt;Menu 3&lt;span class='dropMenu'&gt;...&lt;/span&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Any ideas?</p>
javascript jquery
[3, 5]
4,600,286
4,600,287
Is it possible to launch an android application activity when the phone starts?
<p>Im attempting to build an android application and one of the key features to this application is for it to be able to launch an activity automatically when the phone starts, I see some apps on my phone that already do this, any help would be great so that I can atleast research this a little better through the sdk, thanks! </p>
java android
[1, 4]
461,235
461,236
Make checkbox and a textbox Readonly
<p>Following is my javascript code,is there a way to make checkbox and textbox readonly?</p> <pre><code>//display textboxes and checkbox when condition is true. if($$("id").value =="something"){ document.getElementById("textboxl").style.display=""; document.getElementById("chkbox1").style.display=""; document.getElementById("textbox2").style.display=""; document.getElementById("chkbox2").style.disable=""; } </code></pre> <p>I have to display and then disable it(i mean make it readonly).</p>
javascript jquery
[3, 5]
438,110
438,111
how to redirect when user closes window or tab
<p>Is there a way to redirect the window or tab when a user closes it? This does not work (in jQuery):</p> <pre><code>$(window).bind('beforeunload', function() { window.location = 'anotherpage.html' } </code></pre> <p>Is it even possible? I just want to redirect a user to another page when they close it.</p>
javascript jquery
[3, 5]
740,533
740,534
Does scrollIntoView work in all browsers?
<p>Does scrollIntoView work in all browsers? If not is there a jQuery alternative?</p>
javascript jquery
[3, 5]
2,390,900
2,390,901
Automatically popup browser and tab
<p>I am using a chat section,its work perfectly.But the client wants ,if we got a new message</p> <ol> <li>open the minimized browser automatically </li> <li>open the tab (in the case of same browser and another tab)</li> </ol> <p>is any way to do it using javascript or jquery?</p>
php javascript jquery
[2, 3, 5]
3,146,222
3,146,223
How to set blur for brush?
<p>I have been developing the application which draws on a view using user's finger. So, I have a piece of code which demonstrate settings for Paint, Bitmap, Canvas:</p> <pre><code> mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setDither(true); mPaint.setColor(mForegroundColor); mPaint.setStyle(Paint.Style.STROKE); mPaint.setStrokeJoin(Paint.Join.ROUND); mPaint.setStrokeCap(Paint.Cap.ROUND); mPaint.setStrokeWidth(mBrushWidth); mBitmap = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888); mCanvas = new Canvas(mBitmap); mPath = new Path(); mBitmapPaint = new Paint(Paint.DITHER_FLAG); mBitmap.eraseColor(mBackgroundColor); </code></pre> <p>But now I need to set a blur for brush, but I don't know how I can do it. I hope you can help me. </p>
java android
[1, 4]
709,361
709,362
IFrame and others Reloading after Clone and Append
<p>I have written below JavaScript using JQuery. I have tested it in Firebug and it is working. </p> <p>What I am doing here? I am copying social share bar and putting (after clone) in fixed position near to Post body. I think if someone share something then it will work as everything is same. </p> <p>My question is about optimization. 1) I see every iframe esp. Facebook is reloading again after clone and append. I wish to avoid that. </p> <pre><code>function copySocial() { jQuery('&lt;div/&gt;', { id: 'dsocial', left: '25px', position: 'fixed', top: '400px', width: '44px', display: 'relative' }).appendTo('#container'); var social = jQuery('div.share.social').clone(true).appendTo('#dsocial').css({"left":"25px", "position":"fixed", "top":"400px", "width":"45px"}); } if ((jQuery(window).width() &gt; 1025) &amp;&amp; (jQuery(document).width() &gt; 1025)) { window.setTimeout(copySocial, 20000); } </code></pre> <p>2nd problem is - I have to apply CSS two times. First at new DIV creation time and 2nd at the time of append. Why it is required. I tried to remove CSS (position etc) at the time of DIV creation but it did not work. </p>
javascript jquery
[3, 5]
5,727,916
5,727,917
How to get number of html elements in a string?
<p>How to get number of HTML elements (HTML tags) in a string?</p> <p>For example I have this string: </p> <pre><code>&lt;div&gt; some text &lt;div&gt; &lt;label&gt;some text&lt;/label&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Now how would I find number of html tags in this string? The result in the case above will be 3.</p> <p>I did tried this, thought it will work but it didn't:</p> <pre><code>$('*').length; </code></pre>
javascript jquery
[3, 5]
2,164,319
2,164,320
How to change floating sidebar js code so that it works with ajax pagination?
<p>I have a floating sidebar in my website <pre>www.rayshaft.com</pre> and I also have ajax pagination, so the sidebar is supposed to be floating until it reaches the footer of the page, but the problem is it works only with the 1st page, when the 2nd page is loaded via ajax the sidebar is not floating. I was suggested to change my js code so that every time after ajax page load i need to call scroll function again or i need to recalculate maxY and footTop ech time scroll happens. I don't know any js programming so could you please help me. How can I modify this code to get what I want?</p> <pre><code>$(window).load(function(){ $(function() { var top = $('#sidebar').offset().top - parseFloat($('#sidebar').css('marginTop').replace(/auto/, 0)); var footTop = $('#footer').offset().top - parseFloat($('#footer').css('marginTop').replace(/auto/, 0)); var maxY = footTop - $('#sidebar').outerHeight(); $(window).scroll(function(evt) { var y = $(this).scrollTop(); if (y &gt; top) { if (y &lt; maxY) { $('#sidebar').addClass('fixed').removeAttr('style'); } else { $('#sidebar').removeClass('fixed').css({ position: 'absolute', top: (maxY - top) + 'px' }); } } else { $('#sidebar').removeClass('fixed'); } }); </code></pre>
javascript jquery
[3, 5]
1,188,169
1,188,170
How to validate username with rules
<p>I have set some rules for ma application username like min 3 characters and max 20 characters and only allow small case letter and numbers and only 2 special charters like . and _ that too only once. how can i do this. </p>
javascript jquery
[3, 5]
5,576,849
5,576,850
Change href parameter using jQuery
<p>How do I rewrite an href parameter, using jQuery?</p> <p>I have links with a default city</p> <pre><code>&lt;a href="/search/?what=parks&amp;city=Paris"&gt;parks&lt;/a&gt; &lt;a href="/search/?what=malls&amp;city=Paris"&gt;malls&lt;/a&gt; </code></pre> <p>If the user enters a value into a #city textbox I want to replace Paris with the user-entered value.</p> <p>So far I have</p> <pre><code>var newCity = $("#city").val(); </code></pre>
javascript jquery
[3, 5]
4,175,082
4,175,083
in jQuery, is it possible to halt execution until a user submits a value in a jQuery UI dialog?
<p>Currently, I have an event handler for <code>$('.toggle-enable-item').click(functi ....</code> which does an ajax request and a set of associated callbacks. I would like to just add one for <code>$('.toggle-enable-menu-item .with-comment').click(fun...</code> and set the textarea for that comment to a window.unenable_comment. </p> <p>However, the event for .with-comment just proceeds through. Is there a way to tell Javascript to halt execution until the user clicks the button for 'Add Comment Item'? Ideally, I'd like this to cascade into the 'toggle-enable-item'. FWIW, the prompt call seems to halt execution correctly.</p> <p>Is this happening because the event is being bubbled up? Is there a way I can prevent this bubbling and just make the ajax call separately?</p> <p>non-enabled:</p> <pre><code>&lt;li data-id="1709" data-status="not-enabled" class="toggle-enable-item"&gt;enable&lt;/li&gt; </code></pre> <p>enabled:</p> <pre><code>&lt;li class="toggle-enable-item" data-id="1710" data-status="enabled"&gt; unenable &lt;span class="with-comment"&gt;with comment&lt;/span&gt; &lt;/li&gt; </code></pre> <p>thx</p>
javascript jquery
[3, 5]
5,835,580
5,835,581
Window object as Global Variables Inside Function always undefined
<p>Hi I dont know what I'm missing but if its always says undefined.</p> <pre><code>function report_grid() { $.ajax({ type: "POST", url: "filter_option.php?action=filter", data: $('#form1').serialize(), async: false, success: function(rdata) { window.my_var = rdata } }) } $('#onscreen').click(function() { alert(my_var); return false; }) </code></pre> <p>All my searches to googles shows that this should work, any idea why its not working.</p>
javascript jquery
[3, 5]
963,661
963,662
NotifyPropertyChanged in java - Android
<p>Does anyone know if there is anything in Java similar to <code>NotifyPropertyChanged</code> in C#? I have been searching around, and there is no proper answer.</p> <p>Here is the senerio: In fact,I am working on an android application. The applications will read data from the remote bluetooth device via the bluetooth socket. Once the data is received from the socket, the data will be decoded from the decoder(it is a class) and update the value to the UI. However, I have a decoder class to decode the data from the bluetooth device and a activity which manage to display the value to UI. I need to pass the decoded value from the decoder to the UI. I would think I need a notifypropertychanged event, so that when there is some updated value from the decode, it will inform the ACTIVITY class to update the UI.</p>
java android
[1, 4]
5,122,895
5,122,896
Which Language to choose for a specific project?
<p>For my senior project I am making a program for home automation that will run on a windows computer (can be changed if linux is better choice). The idea is to have a program running all the time that interacts with the user via voice commands. It will listen for a keyword to be said, once triggered the user can then provide the direction whether that be a question, control hardware, etc. The idea is basic similiar to Siri/Google Voice commands but a step further and more focused at controlling various household processes (thermostat, doorlocks, etc.)</p> <p>So the language must be one that has a good openware text to speech and speech to text available to it. The program will be use ardunio and AVR Microcontrollers for different hardware applications of the project (Not sure if this is useful but thought I would share it.) I also will be integrating the wolframalpha <a href="http://products.wolframalpha.com/api/libraries.html" rel="nofollow">api</a> into the application as well, which has a limited number of supported languages. </p> <p>I am open to any language that would make this task run the smoothest but most of my experience is in:</p> <ol> <li>Java</li> <li>Python (small amount)</li> <li>PHP (Don't think is applicable here)</li> </ol> <p>Which language would be the best for this situation?</p>
java python
[1, 7]
3,137,451
3,137,452
Start timer on web application start
<p>I would like to start a <code>System.Threading.Timer</code> in my application when it launches (maybe deploy is the correct word). I have seen that you can use <code>Application_Start()</code> but this is only <a href="http://stackoverflow.com/questions/1384131/configuring-asp-net-to-start-a-method-before-each-application-start-on-iis/1384144#1384144">fired once the first request comes to the application</a>. I need the timer to start as soon as the application is running so that it can check for work to process even if a user is not interacting with the site. How can I get the application to start the timer once it is up and running?</p>
c# asp.net
[0, 9]
5,375,646
5,375,647
How do I find this JQuery element?
<pre><code>&lt;input type="text" class="the_name" data-num="1" value="Choose a Font."&gt; </code></pre> <p>Find all elements that have "input.the_name" <strong>AND</strong> data-num = 1. How do I do both of those attributes?</p>
javascript jquery
[3, 5]
4,112,073
4,112,074
Call jquery from php
<p>I have a form with Name : input and a submit. When pressed, it posts to the same php file. My first check is basically <code>if(!$name) { call jquery to insert error class }</code>. I have the jquery set up in a function but I'm not sure how to call the function from the if statement.</p>
php jquery
[2, 5]
3,899,132
3,899,133
Using jQuery in a Blackboard Building Block
<p>Shot in the dark here, but I'm trying to use jQuery in a custom building block of type module for Blackboard: <a href="http://www.blackboard.com/" rel="nofollow">http://www.blackboard.com/</a>, and would love to know the tag structure I'm suppose to use to get this accomplished.</p> <p>I have tried several combinations of the tags in the library to get this done. Here is my latest attempt:</p> <pre><code>&lt;%@page language="java" pageEncoding="UTF-8"%&gt; &lt;%@page import="blackboard.data.user.*" %&gt; &lt;%@page import="blackboard.platform.session.*" %&gt; &lt;%@page import="blackboard.persist.*" %&gt; &lt;%@page import="java.sql.*" %&gt; &lt;%@page import="java.util.*" %&gt; &lt;%@taglib uri="/bbData" prefix="bbData" %&gt; &lt;%@taglib uri="/bbUI" prefix="bbUI" %&gt; &lt;%@taglib uri="/bbNG" prefix="bbNG" %&gt; &lt;bbUI:docTemplateHead&gt; &lt;script type="text/javascript" src="jquery-ui-1.8.2.custom/js/jquery-1.4.2.min.js&gt;&lt;/script&gt; &lt;script type="text/javascript" src="jquery-ui-1.8.2.custom/js/jquery-ui-1.8.2.custom.min.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="jquery-ui-1.8.2.custom/css/custom-theme/jquery-ui-1.8.2.custom.css" /&gt; &lt;script type="text/javascript"&gt; $(function(){ $('#tabs').tabs(); }); &lt;/script&gt; &lt;/bbUI:docTemplateHead&gt; html here... </code></pre>
java jquery
[1, 5]
225,946
225,947
Jquery slider to show when you click on links
<p>I would like to create a slider for 2 forms that i have.. basically I am going to have Form 1 and Form 2 as text.I would like that when I click on Form 1, a form in a table will slide and become visible underneath the text Form1.... Then if i click Form 2, another form in a table will be visible underneath the text Form 2.... Any help please? thanks</p>
javascript jquery
[3, 5]
3,884,278
3,884,279
How to prepend a string to a string variable in a for loop without changing the loop structure?
<p>If i have a for loop like this:</p> <pre><code>var rows; var len = z[0].length; for ( var i = len; i--; ) { rows += "&lt;tr&gt;&lt;td&gt;" + z[0].Marketer + "&lt;/td&gt;&lt;td&gt;"; } </code></pre> <p>How can i prepend instead of append the current row to this string WithOUT changing the for loop structure?</p> <pre><code>var rows; var len = z[0].length; for ( var i = len; i--; ) { rows (prepend) "&lt;tr&gt;&lt;td&gt;" + z[0].Marketer + "&lt;/td&gt;&lt;td&gt;"; } </code></pre>
javascript jquery
[3, 5]
5,639,276
5,639,277
event.stopImmediatePropagation() does not work on Chrome for Android
<p>I believe <code>event.stopImmediatePropagation()</code> does not work on Chrome for Android. Would anyone have a fix for it ? (alternative code) ? Thanks. </p>
android jquery
[4, 5]
3,917,300
3,917,301
Prompting user when form fields have changed and they do not save
<p>Pretty common scenario here, a user changes fields in a form and leaves the page without saving. I throw a warning message.</p> <p>I first began with using </p> <pre><code>$(window).bind("beforeunload", function(){ }); </code></pre> <p>But I want to throw a Dialog and give the user some options, I opted for this instead. </p> <pre><code>$("#myForm").change( function(){ $("a:not(:#myForm a)").click( function(){ $("#promptDialog").dialog("open"); return false; }); }); </code></pre> <p>The only scenario in which this doesn't accurately work is when the user changes a field, then changes it back to it's original value (It shouldn't prompt, but does).</p> <p>Is this solution elegant, is there a better way to do this?</p>
javascript jquery
[3, 5]
5,726,729
5,726,730
Remove value from option select
<p>Have any chance to remove exp. value="1" option select?</p> <p>Exp. that is my option select:</p> <pre><code>&lt;select name="animals"&gt; &lt;option value="0"&gt;dog&lt;/option&gt; &lt;option value="1"&gt;cat&lt;/option&gt; &lt;/select&gt; </code></pre> <p>How to remove value="0" and value="1"?</p> <p>I try this, that is my form:</p> <pre><code>&lt;form method="post" action="/user/register/" onsubmit="test(this)"&gt; &lt;select name="animals" id="animals"&gt; &lt;option value="0"&gt;dog&lt;/option&gt; &lt;option value="1"&gt;cat&lt;/option&gt; &lt;/select&gt; &lt;/form&gt; </code></pre> <p>That is my test function:</p> <pre><code>function test(form) { form["#animals"].removeAttr("value"); } </code></pre> <p>But have error message:</p> <pre><code>form['#animals'] is undefined </code></pre>
javascript jquery
[3, 5]
698,973
698,974
Populate an array with values from checkboxes and then submit all at once
<p>I'm probably going to need some sort of jquery or JS to accomplish this, and since I suck at using either solution; I was hoping someone could point me in the right direction. Basically I want to be able to select a bunch of records and add them into an array. Once I'm happy with my results, I hit the "Submit" button and off it goes. Think of it as an address book, select a bunch of names to export and then hit "Export" to export the names. </p> <p>Jquery or JS comes into play because I want a div that shows the records that I've selected. So far I've gotten it to work by checking off what i want to export, but it would be nice to show what I've selected thus far in a separate box.</p>
javascript jquery
[3, 5]
382,777
382,778
How can I use my coding skills for good?
<p>By this autumn my two small websites should be generating around a total of $1200 a month with minimal/zero input which is enough to for me to live on comfortably enough. </p> <p>Rather than embark on another business venture, I would love to spend the next few years doing something genuinely good or that helps other people that need it. I want to spend 4 or 5 years dedicating my time to a worthy cause and do the most I can to help with the web development &amp; programming skills that I already have.</p> <p>The problem is that I don't know where to start. I don't have an awesome idea of my own and am very sceptical of many large charities. Ideally I'd like to find a small project where everyone is unpaid and focused on helping.</p> <p>Are there any such small organisations?</p> <p>Does anyone have an idea for a project/website/app that can help people in need that they would like me to work on or work with them on?</p> <p>I know this isn't a typical StackOverflow 2+2=? type question and some of you will be itching to delete it but considering the philanthropic nature of the IT industry (just look at S.O. itself) this is very relevant question to many developers either now or at some point in their careers. Given the recent events in Japan this question is particularly relevant with many people looking for ways they can help others with the skills/time that they have available.</p> <p>Really looking forward to reading your thoughts/answers on this, thanks guys</p>
c# java php javascript jquery
[0, 1, 2, 3, 5]
1,253,768
1,253,769
how to use try catch blocks in a value returning method?
<p>I am checking the uploaded image in a registration form , where i need to use try catch blocks. here is my code:</p> <pre><code>public bool CheckFileType(string FileName) { string Ext = Path.GetExtension(FileName); switch (Ext.ToLower()) { case ".gif": return true; break; case ".JPEG": return true; break; case ".jpg": return true; break; case ".png": return true; break; case ".bmp": return true; break; default: return false; break; } } </code></pre> <p>please suggest me how to use the try catch blocks here.</p> <p>thanks in advance.</p>
c# asp.net
[0, 9]
1,895,332
1,895,333
how can i add animate function here
<p>i am trying to show some div contents when user click a show more button and then hide the div contents when user click a hide button, i want to make this function with some animation. here is my script : </p> <pre><code>$(document).ready(function(){ //Toggling between more results $('.loadMoreDiv').click(function(){ $('#loadMoreDiv').hide(); $('#hideMoreDiv').show(); $('.old_message_block').removeClass('inactive').addClass('active'); $('#messagesLabel').text('showing all messages'); }); $('.lessMoreDiv').click(function(){ $('#hideMoreDiv').hide(); $('#loadMoreDiv').show(); $('.old_message_block').removeClass('active').addClass('inactive'); $('#messagesLabel').text('Most Recent message'); }); }); </code></pre> <p>and my jsfiddle is <a href="http://jsfiddle.net/sureshpattu/JkuW3/1/" rel="nofollow">here</a></p>
javascript jquery
[3, 5]
11,953
11,954
Add javascript pixel values?
<p>Is there a way in javascript/jQuery to take two variables with values "60px" and "40px" and add them together to get "100px"?</p> <p>Or in a more general sense, I'm trying to calculate positions of objects relative to other objects and it would be really convenient if I could do something like this:</p> <pre><code>$('#object2').css('left', $('#object1').css('left')+'60px'); </code></pre> <p>Of course, that just gives in invalid "40px60px".</p>
javascript jquery
[3, 5]
5,061,629
5,061,630
How to logout with jquery or just javascript using form authentication?
<p>I'm using forms authentication in my web application. Is there any way to logout (FormsAuthentication.SignOut;) using jQuery library or javascript?</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
1,676,684
1,676,685
Get a file given a path to the file
<p>I want to get a file which i saved in a specific directory on my phone. How can I find and get a ref to it so I can do with it something different like uploading to a server?</p> <p>Thanks in advance.</p> <p>Shiran</p>
java android
[1, 4]
3,236,380
3,236,381
How do I transfer a javascript value to a php variable?
<p>I have an html table containing values that are being generated from javascript. How do I transfer those values to php variables?</p>
php javascript
[2, 3]
5,680,568
5,680,569
Is there a ? conditional test in Javascript like in C#?
<p>I have the following:</p> <pre><code>var isChecked = $('#htmlEdit').is(":checked"); </code></pre> <p>But I don't really need the variable isChecked and what I want to do is to assign a value to a variable called "action" so that if the test on the right above is true then </p> <pre><code>var action = "Editing HTML" </code></pre> <p>if not then </p> <pre><code>var action = "Editing" </code></pre> <p>Is there a clean way to do this without just using an if-else?</p>
javascript jquery
[3, 5]
2,578,695
2,578,696
javascript on click event is not working fine on img tag
<p>I am trying to open a link on image click using follwoing code</p> <pre><code> &lt;img src="AllScripts/SliderImages/images/1Main.png" alt="" title="" onclick="openSliderImage(id);" onmouseover="this.style.cursor='hand'" width="800px" height="300px" id="http://www.google.com" /&gt; </code></pre> <p>It is working fine but when generating image using c# write code using response.write code it doesn't work and goes on the follwoing link</p> <pre><code>http://localhost:1234/AllScripts/SliderImages/images/1Main.png </code></pre> <p>Follwoing code is used to write html</p> <pre><code> &lt;% { Response.Write(SlidingImages); } %&gt; </code></pre> <p>I know it pick the <code>image src</code> rather then <code>image id</code> on image click but why? This is the javascript function</p> <pre><code> function openSliderImage(id) { alert(id); window.open(id, '_blank'); } </code></pre>
javascript asp.net
[3, 9]
1,207,124
1,207,125
Making divs constantly move randomly
<p>I have created a shooting game for children, where they have to shoot the correct number (depending on the question) when it appears. My problem is at the moment the numbers appear one at a time but I would like to make it so that the canvas is constantly populated with numbers that keep moving around like the shapes in this example... <a href="http://sheppardsoftware.com/mathgames/earlymath/shapes_shoot.htm" rel="nofollow">http://sheppardsoftware.com/mathgames/earlymath/shapes_shoot.htm</a></p> <pre><code>function moveRandom(id) { var cPos = $('#container').offset(); var cHeight = $('#container').height(); var cWidth = $('#container').width(); // get box padding (assume all padding have same value) var pad = parseInt($('#container').css('padding-top').replace('px', '')); // get movable box size var bHeight = $('#' + id).height(); var bWidth = $('#' + id).width(); // set maximum position maxY = cPos.top + cHeight - bHeight - pad; maxX = cPos.left + cWidth - bWidth - pad; // set minimum position minY = cPos.top + pad; minX = cPos.left + pad; // set new position newY = randomFromTo(minY, maxY); newX = randomFromTo(minX, maxX); $('#' + id).css({ top: newY, left: newX }).fadeIn(2000, function() { setTimeout(function() { $('#' + id).fadeOut('fast'); window.cont++; }, 1500); }); </code></pre> <p>Here is the version I have created <a href="http://jsfiddle.net/pUwKb/5/" rel="nofollow">http://jsfiddle.net/pUwKb/5/</a></p>
javascript jquery
[3, 5]
5,583,479
5,583,480
Auto Flip Tab on specific time duration
<p>All</p> <p>I am using this flip tab for my project.</p> <p>This is js fiddle link : <a href="http://jsfiddle.net/ajaypatel_aj/XbhUW/1/" rel="nofollow">http://jsfiddle.net/ajaypatel_aj/XbhUW/1/</a></p> <p>Js code </p> <pre><code>$('document').ready(function(){ $('#flip-container').quickFlip(); $('#flip-navigation li a').each(function(){ $(this).click(function(){ $('#flip-navigation li').each(function(){ $(this).removeClass('selected'); }); $(this).parent().addClass('selected'); var flipid=$(this).attr('id').substr(4); $('#flip-container').quickFlipper('', flipid, 1); return false; }); }); </code></pre> <p>});​</p> <p>I tried the below code:</p> <pre><code> $('document').ready(function(){ $('#flip-container').quickFlip(); $('#flip-navigation li a').each(function(){ $(this).delay(800)(function(){ $('#flip-navigation li').each(function(){ $(this).removeClass('selected'); }); $(this).parent().addClass('selected'); var flipid=$(this).attr('id').substr(4); $('#flip-container').quickFlipper('', flipid, 1); return false; }); }); });​ </code></pre> <p>But it didn't work for me. What i want is auto flip this for 1000 ms.</p>
javascript jquery
[3, 5]
5,323,245
5,323,246
Javascript: Timed href change
<p>Having a slight Javascript issue at the moment, I am hoping to have the below image have a variable HREF which is triggered by a time change. </p> <p>At the moment it is triggering to some extent but then getting stuck on one of the URLs. It is also affecting an image which is overlaid on top of this one. Which isn't the aim at all!</p> <p>Any help would be great. Thanks. </p> <pre><code>&lt;div style="position: absolute; left: 0; top: 0; z-index: 100"&gt;&lt;a href="[VARIABLE URL]"&gt;&lt;img src="[BACKGROUNDIMAGE]" style="position: absolute top: 0; left: 0;"/&gt;&lt;/a&gt;&lt;/div&gt; &lt;script type="text/JavaScript"&gt; setTimeout(hyperlink1,3000); setTimeout(hyperlink2,3000); setTimeout(hyperlink3,3000); function hyperlink1 () { $("a").attr("href", "[URL1]") } function hyperlink2 () { $("a").attr("href", "[URL2]") } function hyperlink3 () { $("a").attr("href", "[URL3]") } &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
4,048,479
4,048,480
Clip text in C# after the third word
<p>I have a text(title) which has values like "Zesty Bean Bites South of the Border ". I need to add ... after the 3rd word in title .How can we achieve this ? i tried using Substring() method but it wont split by words ? </p>
c# asp.net
[0, 9]
115,639
115,640
Set cookie domain with Javascript variable
<p>Im taking the domain from the HTML of the page using jQuery:</p> <pre><code>domainUrl = $("p.domain").text(); </code></pre> <p>for the purposes of testing:</p> <pre><code>&lt;p class="domain"&gt;.vl3.co.uk&lt;/p&gt; </code></pre> <p>Which is also the domain Im testing the script on.</p> <p>This then give an alert containing the correct domain:</p> <pre><code>alert(domainUrl); </code></pre> <p>I want to the use that variable to set the domain in a cookie:</p> <pre><code>set_cookie('visible', 'no', 2020, 1, 1, '/', '+domainUrl+'); </code></pre> <p>Here is the set cookie function:</p> <pre><code>function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure ) { var cookie_string = name + "=" + escape ( value ); if ( exp_y ) { var expires = new Date ( exp_y, exp_m, exp_d ); cookie_string += "; expires=" + expires.toGMTString(); } if ( path ) cookie_string += "; path=" + escape ( path ); if ( domain ) cookie_string += "; domain=" + escape ( domain ); if ( secure ) cookie_string += "; secure"; document.cookie = cookie_string; } </code></pre> <p>Why doesnt the cookie domain get set? </p> <p>I think the problem is how im using the domainUrl variable when setting the cookie?</p>
javascript jquery
[3, 5]
2,345,813
2,345,814
Getting the text of all inputs in a form using jquery
<p>I am trying to consolidate all inputs on my form into one string, but my code just overwrites the var on each loop leaving me with only the text from the last input on the form... How can I fix this?</p> <pre><code>$(':input').each(function() { var output = $(this).val(); $('#output').html(output); }); </code></pre>
javascript jquery
[3, 5]
1,146,821
1,146,822
preventDefault does not work on focus event
<p>I am trying to design a form such that if it has a certain class, the user should not be able to interact with any of the inputs. For various reasons, I would like to avoid using the "disabled" attribute. I am trying to prevent the default on the focus event and it is not working. I tested this in recent versions of Firefox, Chrome, and Android. I tried various combinations of events, such as "click change touchstart focus focusin". I tried puting "return false;" in the handler. Does anyone know why this is happening and how to make it work?</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt;&lt;head&gt; &lt;title&gt;input test&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;form class="disabled"&gt; &lt;input type="text"&gt; &lt;/form&gt; &lt;script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(".disabled :input").bind("focus", function(e) { e.preventDefault(); }); &lt;/script&gt; &lt;/body&gt;&lt;/html&gt; </code></pre> <p>You can see an example at <a href="http://jsfiddle.net/54Xka/" rel="nofollow">http://jsfiddle.net/54Xka/</a></p> <p><strong>EDIT:</strong> This will be on a site intended mostly for mobile browsers. I am planning to disable the inputs when a modal dialog is showing. The modal dialog is implemented using my own code. It is something very simple that shows and hides a div.</p> <p><strong>EDIT 2:</strong> This is what I have now:</p> <pre><code>$(".disabled :input").live({ focus: function() { $(this).blur(); }, change: function(e) { e.preventDefault(); } }); </code></pre> <p>It has some minor aesthetic issues but it works. When I have more time, I may try jfriend00's idea with the transparent gif, or something similar to what the jQuery UI dialog widget does, or maybe actually using the jQuery UI dialog widget to implement the dialog.</p>
javascript jquery
[3, 5]
674,090
674,091
Does Android have any way to detect cyanogenmod and its version?
<p>I'm working on an android media player which needs equalizer. However, equalizer is only available on Gingerbread and above, but cyanogenmod 6 has modified audioflinger to act as equalizer, so I want to detect OS version.</p>
java android
[1, 4]
3,099,893
3,099,894
javascript regex does not work for sentence string
<p>I am writing a function which takes string as an argument. Then if the string begins with capital letter then return true otherwise return false. But my current function only works for one word string which I want it to work for both one word and a whole sentence. How can I improve my code to achieve this? Secondly, it should not work when numbers are passed inside sentence. How can I do this?</p> <p>Here is my code</p> <pre><code>function takeString (str) { var regex = /^[A-Za-z]+$/; if (str.match(regex)) { if (str.charAt(0) === str.toUpperCase().charAt(0)) { alert('true'); return true; } else { alert('false'); return false; } } else { alert('Only letters please.'); } } takeString('This is'); // shows Only letters please which is wrong. this should work takeString('String); // returns true which right takeString('string'); // returns false which is right takeString('This is 12312321'); // shows only letters please which is right bcoz it has digits takeString('12312312'); // show Only letters please which is right. </code></pre> <p>​</p>
javascript jquery
[3, 5]
1,077,712
1,077,713
Obtaining information from a picture taken with the camera device
<p>I started to develope a new application for Android OS and the idea of this application is to find some words from the picture that taken with the camera device.</p> <p>I don't know how to find words and if it's a long sentence so the application will divide the words.</p> <p>Does you have some ideas for this?</p>
java android
[1, 4]
5,895,793
5,895,794
How to call a asp.net page asynchronously using JQuery
<p>I want to call a aspx page method asynchronously using JQuery</p>
asp.net jquery
[9, 5]
1,419,942
1,419,943
Event not firing on dropdown list when disabled
<p>This client side script is being added to buttons in our existing codebase. It basically shows a pop-up that the system is busy whenever a long running process is occuring. this works fine for buttons, however the btn.disabled = true line causes the SelectedIndexChanged event to never fire(when using it on a button, the click even still fires). If I comment out that line, it fires fine. The object is disabled to prevent double clicking. Any ideas on why its not firing? This code is being registered as a client script block, so any changes affect all of the buttons using this code on a page. </p> <pre><code>@"&lt;script language='javascript' type='text/javascript'&gt; function BB(btn, msg, btnID) { bb1 = new BusyBox('iBB1', 'bb1', 4, '" + ContentImageUrlPath + @"/gears_ani_', '.gif', 125, 147, 207, msg); btn.disabled = true; bb1.Show(); __doPostBack(btnID,''); return false; }&lt;/script&gt;"; </code></pre> <p>Here is the code as seen on the page</p> <pre><code>&lt;select id="foo" onchange="return BB(this, 'Processing','ddlRoadsAssessment'); setTimeout('__doPostBack(\'foo\',\'\')', 0)" name="foo"&gt; </code></pre>
asp.net javascript
[9, 3]
720,415
720,416
Multi step form with jQuery which degrades nicely if JS is turned off
<p>I currently had my form set up so that each section was refreshed using Ajax, however it didn’t degrade gracefully with JavaScript turned off and I’ve looked into putting each part of the form in to a separate view which works fine but isn’t that great to be honest.</p> <p>I know the client wants it to look nice so I thought about using jQuery to show and hide forms, so if JavaScript is turned off then all of the forms build in to one long form. However the only problem I am facing is that after each section the user needs to submit this information for it to be validated before the next stage is completed. How can I do this if JavaScript is turned off because the other forms will be visible...</p> <p>Any ideas? Thanks.</p>
javascript jquery
[3, 5]
4,515,039
4,515,040
Bind Telerik radmenu from database using Dataset in winforms
<p>how to bind rad menu from database using <strong>dataset or datatable</strong> in windows forms .i am unable to bind submenu in telerik radmenu winforms </p>
c# asp.net
[0, 9]
3,536,656
3,536,657
Disable certain tags and javascript inside an element?
<p>I run a forum and there's an option to enable full html coding in posts. However, it does not have the option to disable javascript and tags, to my chagrin. For security reasons, I wanted to disable them, which brings me to the question: is there any way via jquery or javascript to accomplish this? I have been searching for it but to no avail.</p> <p>Note: All posts are enclosed in <code>&lt;div class="postcolor"&gt;&lt;/div&gt;</code> tags.</p> <p>Thank you!</p>
javascript jquery
[3, 5]
3,876,754
3,876,755
Tutorials for an experienced C# user to learn C++
<p>Are there any good resources for learning C++ that a C# user could use, which don't require knowledge of C? </p> <p>I have quite a good knowledge of C# via courses in my University's game development program (in a 300 level course right now) but now I need to use C++ for a project. </p> <p>I would use a beginner tutorial but they are so hard for me to follow and learn the basic syntax because they start so slowly.</p> <p>I found a few of tutorials for switching from C++ to C#, but none in the other direction. I do have a little bit of Objective C practice from iPhone programming as well.</p>
c# c++
[0, 6]
4,982,499
4,982,500
php array in javascript variable for jquery autocomplete
<p>I am using jquery autocomplete and trying to define the values for the auto complete options.</p> <p>I am trying to create a javascript variable from a php array. So far i have:</p> <pre><code>&lt;?php $usernames = get_records_sql("SELECT firstname,lastname FROM {$CFG-&gt;prefix}user ORDER BY lastname DESC"); ?&gt; &lt;script language="javascript"&gt; var names = ['&lt;?php echo $usernames; ?&gt;']; &lt;/script&gt; </code></pre> <p>I just need to convert the array to this format</p> <pre><code>var names= ["firstname lastname", "firstname lastname", "firstname lastname"]; </code></pre> <p>Any help would be much appreciated.</p>
php javascript
[2, 3]
485,403
485,404
How do I convert this Python punctuation-stripping function to JavaScript?
<p>Please can anyone translate this python code into javascript.</p> <pre><code># def strip_punctuation(s): # for c in ',.":;!%$': # while s.find(c) is not -1: # s.replace(c, '') </code></pre>
javascript python
[3, 7]
5,006,032
5,006,033
Find IP address using jQuery
<p>I tried to get my IP using the following code:</p> <pre><code>$.getJSON("http://jsonip.appspot.com?callback=?", function(data){ip=data.ip}); </code></pre> <p>But it doesn't seems to work for me. Please Help.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
5,578,685
5,578,686
click on a button and inside a button to raise another button to be clicked with code behind?
<p>For example I have 2 buttons:</p> <pre><code>&lt;asp:button id="button1" onClick="Button1_click" runat="server"/&gt; &lt;asp:button id="button2" runat="server"/&gt; Button1_click(sender, args) { //how to call button 2 to be clicked? } </code></pre> <p>How could I write code behind to fire the button2 to be clicked?</p>
c# asp.net
[0, 9]
516,210
516,211
Is it possible to do ".value +=" in JQuery?
<p>Classic javascript:</p> <pre><code>var myvar = document.getElementById("abc"); abc.value += "test"; abc.value += "another test"; </code></pre> <p>Jquery:</p> <pre><code>$("#abc").val($("#abc").val()+"test"); $("#abc").val($("#abc").val()+"another test"); </code></pre> <p>Is there a way to make my Jquery prettier, maybe with a hidden += function that I could use? I know that .val() is not an attribute, but I feel there must be a way to make this code more beautiful to look at...</p> <p>Something like this would be great:</p> <pre><code> $("#abc").valueAttribute += "test" $("#abc").val().content += "test" $("#abc").val().add("test") </code></pre>
javascript jquery
[3, 5]
3,303,814
3,303,815
How to add dynamic rows to a table on C#
<p>Hi i have a table and i want to add dynamic rows to that through C# ... how can i do this.... advance thanks</p>
c# jquery
[0, 5]
4,598,185
4,598,186
jQuery prepending and fading in content does not work
<p>So I have an ajax form submission system, and I want to prepend the submitted form directly into the HTML when a successful status response is given. Right now I have,</p> <pre><code>$(".post-submit").click(function(){ var postcontent = $(".post-form").val(); if (postcontent == ""){ return false; } $(".post-form").attr("disabled", "disabled"); $.ajax({ url: "/post", type: "POST", dataType: "json", data: {"post-form":postcontent}, success: function(response, textStatus, jqXHR) { var htmlpost = '&lt;div class="post"&gt; &lt;b&gt;${name}&lt;/b&gt; &lt;/div&gt; \n &lt;p&gt;' + postcontent + '&lt;/p&gt; \n'; $(htmlpost).hide().prependTo(".posts-content").fadeIn("slow"); }, error: function(jqXHR, textStatus, errorThrown){ alert("Unexpected internal server error. Please try again later."); } }); }); </code></pre> <p>But when I submit a form and get a status 200 back from the server, it doesn't do anything, and the form remains disabled.</p>
javascript jquery
[3, 5]
4,742,894
4,742,895
JQuery not initializing properly
<p>I am working on a basic Jquery script to hide a button after it is clicked on an HTML Page. However, when it is clicked the button does nothing. code is below. JQuery has been update to it's most recent version.</p> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Test Page&lt;/title&gt; &lt;script type = "text/javascript"&gt; $(document).ready( function(){ $('#button').click(function(){ $('#button').toggle(); }); }); &lt;/script&gt; &lt;script type = "text/javascript" src="jquery-2.0.1.js"&gt;&lt;/script&gt; &lt;link rel="stylesheet" type="text/css" href="style.css"&gt; &lt;/head&gt; &lt;body&gt; &lt;div id = "button"&gt;Find Printer&lt;/div&gt; &lt;/body&gt; </code></pre>
javascript jquery
[3, 5]
2,362,178
2,362,179
The info about unread emails reading from a content provider
<p>I have been developing the application which need to get information about unread emails. Are there any means which allows to get this information from any content provider? </p>
java android
[1, 4]
5,812,844
5,812,845
How to create C++ class in android project via Eclipse?
<p>In order for reuse ability on iOS, I would like to write the logic for my Android game in C++ rather than java. How can I create a C++ class in eclipse and integrate it into my application?</p> <p>I have read "native C++ code can be used on Android as well using the Native Development Kit (NDK)". What is the latest and greatest way to do this? I am writing a simple OpenGL app? Are there any tutorials out there that people have found useful?</p> <p>Thanks very much.</p>
android c++
[4, 6]
3,002,209
3,002,210
jquery timer vs javascript timer?
<p>which timer is better for use in term of performance ? the Jquery Timer or The Javascript Timer.</p> <p>the page that has the timer doesnt have any Jquery code.</p> <p>Thanks</p>
javascript jquery
[3, 5]
375,896
375,897
Pass a method as an argument
<p>How do I pass a method as an argument? I do this all the time in Javascript and need to use anonymous methods to pass params. How do I do it in c#?</p> <pre><code>protected void MyMethod(){ RunMethod(ParamMethod("World")); } protected void RunMethod(ArgMethod){ MessageBox.Show(ArgMethod()); } protected String ParamMethod(String sWho){ return "Hello " + sWho; } </code></pre>
c# asp.net
[0, 9]
579,126
579,127
Changing value of custom select option - Javascript
<p>I need assistance changing the value of a custom-select box. I cannot use JQuery because I already have a change() function hooked up to it.</p> <p>How can I change the value of the select box in Javascript?</p> <p>This is my custom select function:</p> <pre><code>$.fn.customSelect = function() { if ( $(this).length ) { $(this).find('select').attr('selectedIndex',-1).change(function() { var optionText = $(this).find('option:selected').text(); $(this).siblings('label').text(optionText) }); } </code></pre> <p>};</p> <p>I have tried:</p> <pre><code>var field = document.getElementById('test5'); field.value = '2'; field.focus(); </code></pre> <p>This will select the option, but it will not show up as the default option (hopefully you guys can understand this haha).</p> <p>Any possible solutions?</p>
javascript jquery
[3, 5]
5,909,278
5,909,279
For a dropdownlist, SelectedIndex always returns the value 0
<p>I have a dropdown in my webpage, which always returns the value 0 as the selected index no matter whichever item the user selects. I have populated the dropdown using a DB query. And I am populating in on Page_Load method in my page. The code shown below does the specified work: int danceid;</p> <pre><code> protected void Page_Load(Object sender, EventArgs e) { if (!IsPostBack) { PopulateDanceDropDown(); } } private void PopulateDanceDropDown() { DataTable dt = new DataTable();DataRow row = null; dt.Columns.Add("Did", Type.GetType("System.Int32")); dt.Columns.Add("DName", Type.GetType("System.String")); var dancer_dance = (from dd in context.DANCER_AND_DANCE where dd.UserId == dancerId select new { Value = dd.DanceId, Text = dd.DanceName }).ToList(); foreach (var dndd in dancer_dance) { row = dt.NewRow(); row["Did"] = dndd.Value; row["DName"] = dndd.Text; dt.Rows.Add(row); dances.DataSource = dt; dances.DataTextField = dt.Columns[1].ToString(); if (!IsPostBack) { dances.DataBind(); } } protected void changeIndex(object o, EventArgs e) { danceid = dances.SelectedIndex; } protected void dropthedance(object o, EventArgs e) { int danceIDFromDropDown = danceid; var dancer_dance = from dd in context.DANCER_AND_DANCE where dd.DanceId == danceIDFromDropDown select dd; foreach (var dndd in dancer_dance) { context.DANCER_AND_DANCE.DeleteOnSubmit(dndd); } try { context.SubmitChanges(); } catch (Exception ex) { Console.WriteLine(ex); } } </code></pre> <p>The line int danceIDFromDropDown = danceid; in the method dropthedance always has the value 0. Pleaseeeeeeeeeeeeee help someone </p>
c# asp.net
[0, 9]
4,598,060
4,598,061
jQuery: Finding second closest div
<p>How can I find the second closest div?</p> <p>For example, to get the closest one, I am successfully using:</p> <pre><code>var closest_div_id = $(this).closest('div').attr('id'); </code></pre> <p>Now, how do I get the second closest? Something like: </p> <pre><code>$(this).(closest('div').closest('div')).attr('id'); ??? </code></pre>
javascript jquery
[3, 5]
1,989,773
1,989,774
In Android, how do I query MediaStore only for files in a specific path? Or alternatively, only display files in a certain path?
<p>Suppose I have an Android block of code that looks something like this:</p> <pre><code>String[] proj = {MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media._ID}; int[] to = new int[] { R.id.artist_name }; Cursor musiccursor = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, null, null, MediaStore.Audio.Media.ARTIST); ListView musiclist = (ListView) findViewById(R.id.mylist); SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.songitem, musiccursor, proj, to); musiclist.setAdapter(mAdapter); </code></pre> <p>But what I want, is this:</p> <pre><code>String selection = MediaStore.Audio.Media.FILE_PATH + " ilike '%audio%books%'"; String[] proj = {MediaStore.Audio.Media.ARTIST, MediaStore.Audio.Media._ID}; int[] to = new int[] { R.id.artist_name }; Cursor musiccursor = managedQuery(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI, proj, selection, null, MediaStore.Audio.Media.ARTIST); ListView musiclist = (ListView) findViewById(R.id.mylist); SimpleCursorAdapter mAdapter = new SimpleCursorAdapter(getApplicationContext(), R.layout.songitem, musiccursor, proj, to); musiclist.setAdapter(mAdapter); </code></pre> <p>The only problem, of course, is that FILE_PATH is not actually a column I can use, and as far as I can tell, no such column exists.</p> <p>So I'm wondering:</p> <ol> <li>Is there a way to query only for music in a certain directory? If so, how?</li> <li>If that's not an option, should I make a ListAdapter that filters by directory? If so, again, how would I go about in doing that?</li> </ol> <p>Thanks for any advice.</p>
java android
[1, 4]
4,052,016
4,052,017
ASPX Null Character Bug
<p>I have an .aspx page that I'm trying to render, but when I go to render characters, I get strange results.</p> <pre><code>&lt;%= default(char) %&gt; </code></pre> <p>Expands to the following in FF and Chrome, but not in IE:</p> <pre><code>� </code></pre> <p>Is there a way to ignore the value if it's the null character? I've tried <code>default(char).ToString()</code>, but it seems have the same result. When there's a null character, I just want to ignore it.</p>
c# asp.net
[0, 9]
1,210,978
1,210,979
How to draw dotted lines between geopoints in google map on android
<p>I have displayed the locations on map with marker images, but now i want to connect the locations by dotted lines, in same line locations.</p> <p>Please give any idea....</p>
java android
[1, 4]
4,790,699
4,790,700
how to determine if user left our site
<p>We're tryin to implement some kind of feedback, which I saw in MSDN web-site. More concrete when user first enters to our site, I want to show a pop-up which will ask user to leave comment rite before he would leave our web-site, and depending on user's answer( it would be some kind of confirmation box with Yes and No), I want to open a pop-up with TextBox for user to leave a feedback. I've searched for this in internet, but all of 'em was about handling window.onload event, the problem is we have more than one page, so I won't be able to determine if user requests another page in our web-site or redirects to another web-site. So this is my problem, any suggestions? We're using asp.net. Thanx beforehand.</p>
jquery asp.net
[5, 9]
4,592,961
4,592,962
C# ASP.NET - Get current application physical path within Application_Start
<p>I'm not able to get the current physical path within Application_Start using </p> <p><code></p> <pre><code>HttpContext.Current.Request.PhysicalApplicationPath </code></pre> <p></code> because there is no <strong>Request</strong> object at that time.</p> <p>How else can I get the physical path?</p>
c# asp.net
[0, 9]
835,540
835,541
copy contents of div to clipboard
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/400212/how-to-copy-to-clipboard-in-javascript">How to Copy to Clipboard in JavaScript?</a> </p> </blockquote> <p>Is there a way to copy the contents of a div into a clipboard using javascript/jquery without using an external plugin?</p>
javascript jquery
[3, 5]
3,113,852
3,113,853
change ASP.NET control ID in Javascript
<p>I've a table in my ASP.NET app, and add rows dynamically to it, each row has some cells each including a textbox, I generate everything dynamically, for instance:</p> <pre><code> tc = new TableCell(); TextBox t_total = new TextBox(); t_total.ID = "txtTotal" + dt.Rows[i]["Id"].ToString(); tc.Controls.Add(t_total); tr.Cells.Add(tc); </code></pre> <p>I set an ID for my textbox, then I use this ID to access this object in a JavaScript function. How can I change this ID in my JavaScript function? for instance my textbox ID is set to "txtTotal1000" initially, then I'm going to change its ID to "txtTotal2000" in my JavaScript function so that I can access it using this new ID, how can I do so?</p>
javascript asp.net
[3, 9]
1,330,865
1,330,866
How to read href attribute with JQuery
<p>I use <code>$(this).attr('href')</code> in JQuery to read the string in href="" attribute. I have those kind of links:</p> <pre><code>&lt;a href="1"&gt;&lt;/a&gt; &lt;a href="2"&gt;&lt;/a&gt; &lt;a href="3"&gt;&lt;/a&gt; </code></pre> <p>Firefox and Chrome return me the code correctly. IE return me: <code>http://127.0.0.1/1</code></p> <p>How can i do?</p>
javascript jquery
[3, 5]
3,102,727
3,102,728
Loading Javascript through PHP
<p>From a tutorial I read on Sitepoint, I learned that I could load JS files through PHP (it was a comment, anyway). The code for this was in this form:</p> <pre><code>&lt;script src="js.php?script1=jquery.js&amp;scipt2=main.js" /&gt; </code></pre> <p>The purpose of using PHP was to reduce the number of HTTP requests for JS files. But from the markup above, it seems to me that there are still going to be the same number of requests as if I had written two tags for the JS files (I could be wrong, that's why I'm asking).</p> <p>The question is how is the PHP code supposed to be written and what is/are the advantage(s) of this approach over the 'normal' method?</p>
php javascript
[2, 3]
2,832,080
2,832,081
text area like FCK editor
<p>I would like to develop a html editor just like FCKeditor, but i dont know how they display the html code in text area like region, Will U pls help me with that? for having that textarea, which prase html codes and displays just like a web page?</p>
php javascript
[2, 3]
441,492
441,493
how to check parent in jquery
<p>I bind a click event over the <code>document</code>. I have a div with id <code>parent</code>. Now whenever the click event occur over the <code>document</code> than i am trying to check the target element is the child of <code>div ( id = parent )</code> or not.</p> <pre><code> &lt;div id="parent"&gt; &lt;div id="c1"&gt; &lt;div id="gc1"&gt; &lt;/div&gt; &lt;div id="gc2"&gt; &lt;/div&gt; ... &lt;/div&gt; ... &lt;/div&gt; </code></pre> <p>For this purpose i wrote the following jquery code :</p> <pre><code>$(document).click( function(e) { if($(e.target).parents("#parent").length &gt; 0) //this condition is not working as expected { } }); </code></pre> <p>What i am doing wrong here?</p>
javascript jquery
[3, 5]
3,303,063
3,303,064
Calculate gesture distance in Android
<p>I'm trying to find a way to calculate the distance traveled during a Gesture. I can get the distance between two points using MotionEvent.ACTION_DOWN and MotionEvent.ACTION_UP or MotionEvent.ACTION_MOVE. But that doesn't account for moving in say, a circle. It would calculate 0 because you moved all the way back around. I'm looking for total distance traveled, preferably in pixels so I can manipulate it further, if needed.</p>
java android
[1, 4]
3,408,402
3,408,403
What's the reason behind to include a engine in Java to run JavaScript?
<p>To let JavaScript able to run in server-side? </p> <p>If it's justified, what's the advantage? and any good application for such use?</p>
java javascript
[1, 3]
1,148,415
1,148,416
Code behind value of a control in an user control
<p>I am getting ImageButtons ID which is a part of my user control. To this imageButton i have a primary key(code) associated with it. I am getting the ID of the image button (" ImgBtn" ). How do I get the Code(primary key) of the image button that is present on the page.</p> <p>Below is my code that I am executing.</p> <pre><code>Control ctrl_Usr = (Page.LoadControl("Product_UserControl.ascx")); Control myControl = FindControlRecursive(ctrl_Usr, "imgBtn"); string id = myControl.ID; </code></pre> <p>Function is :</p> <pre><code>public static Control FindControlRecursive(Control container, string name) { if ((container.ID != null) &amp;&amp; (container.ID.Equals(name))) return container; foreach (Control ctrl in container.Controls) { Control foundCtrl = FindControlRecursive(ctrl, name); if (foundCtrl != null) return foundCtrl; } return null; } </code></pre> <p>Now in string variable id i want the code say (code_101) insted of imgBtn.</p>
c# asp.net
[0, 9]
3,574,488
3,574,489
Update Javascript variable from PHP without page reload
<p>I am using jCart as shopping cart, and from jCart it's possible to get the variable <code>$subtotal</code>.</p> <p>However, when changing something in the shopping cart, the variable <code>$subtotal</code> doesn't change until a page reload.</p> <p>Is it possible to use jQuery to update <code>$subtotal</code> on page click with <code>.click(function())</code> ?</p>
php jquery
[2, 5]
4,326,910
4,326,911
listview scrolls to top after editing entry
<p>I am trying to create a listview that when you click on an entry you may modify it and after hitting confirm it will still show the entry you just modified instead of scrolling to the top. </p> <p>made advised changes and after leaving the edit activity it still scrolls to the top and does not find the correct scroll position. am i missing something?</p> <pre><code>static int firstPosition = 0; protected void onListItemClick(ListView l, View v, int position, long id) { super.onListItemClick(l, v, position, id); Cursor c = mNotesCursor; ListView mListView = getListView(); firstPosition = mListView.getFirstVisiblePosition(); c.moveToPosition(position); Intent i = new Intent(this, QuoteEdit.class); i.putExtra(QuotesDBAdapter.KEY_ROWID, id); i.putExtra(QuotesDBAdapter.KEY_QUOTES, c.getString( c.getColumnIndexOrThrow(QuotesDBAdapter.KEY_QUOTES))); startActivityForResult(i, ACTIVITY_EDIT); } public void onResume(int requestCode, int resultCode, Intent intent) { ListView mListView = getListView(); if (mListView != null &amp;&amp; firstPosition &gt;= 0){ mListView.scrollTo(0,firstPosition); // mListView.setSelection(firstPosition); } } protected void onActivityResult(int requestCode, int resultCode, Intent intent) { try { super.onActivityResult(requestCode, resultCode, intent); Bundle extras = intent.getExtras(); switch(requestCode) { case ACTIVITY_CREATE: String title = extras.getString(QuotesDBAdapter.KEY_QUOTES); mDbHelper.createQuote(title); break; case ACTIVITY_EDIT: ListView mListView = getListView(); Long rowId = extras.getLong(QuotesDBAdapter.KEY_ROWID); if (rowId != null) { String editTitle = extras.getString(QuotesDBAdapter.KEY_QUOTES); mDbHelper.updateQuote(rowId, editTitle); mListView.setSelection(firstPosition); } fillData(); break; } } catch (Exception ex){ Context context = getApplicationContext(); CharSequence text = ex.toString(); int duration = Toast.LENGTH_LONG; Toast toast = Toast.makeText(context, text, duration); toast.show(); } } </code></pre>
java android
[1, 4]
5,622,797
5,622,798
JQuery next class on click
<p>Is there a way to grab the first class, after a given class?</p> <p>The code below only selects the first class (I'm aware of what <code>first</code> does) but I want it to select each first <code>.FAQAnswers</code> after each <code>FAQName</code> is this possible?</p> <pre><code> $(".FAQName").click(function () { $('.FAQAnswers').first().toggle(200); }); &lt;div class="FAQName"&gt;Question&lt;/div&gt; ... &lt;div class="FAQAnswers"&gt;Answer&lt;/div&gt; &lt;div class="FAQName"&gt;Question&lt;/div&gt; ... &lt;div class="FAQAnswers"&gt;Answer&lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
1,225,991
1,225,992
Tackling browser Autofill with jQuery
<p>I wanted to make a particular checkbox visible when I type at-least one character in it, the following jQuery function works brilliantly for all test cases but not one : What if the browser autofills the input (say via remember me.). In this case the checkbox is not visible when the browser has filled in content by default, but comes up as soon as I start editing it. How to tackle it?</p> <p>Also, instead of a placeholder attribute, I am using a label styled inside the input element that goes away if there is any text (works for above test case too)</p> <p>Here is my JavaScript for the initial code :-</p> <pre><code> var hideToggleBtn = function(input, label) { // 'show password' checkbox input.showPassword().keyup(function(){ if (input.val().length == 0) { label.hide(); } else { label.css("display", "inline").show(); } }); label.hide(); }; hideToggleBtn($('#password'), $('label[for=show]')); hideToggleBtn($('#adminpass'), $('label[for=show]')); hideToggleBtn($('#pass2'), $('label[for=personal-show]')); </code></pre> <p>This is regarding a jQuery plugin I am using : <a href="http://unwrongest.com/projects/show-password/" rel="nofollow">http://unwrongest.com/projects/show-password/</a></p> <p>I know that keyup(); function doesn't detect a browser refill, so a solution is most welcome. </p>
javascript jquery
[3, 5]
5,388,826
5,388,827
jQuery and ASP.NET - forcing button click
<p>I have a ASP.NET page which has a form on it. It also has a search form on it. The search is in the top-right of the page, so the button for the search is the first added to the control hierachy.</p> <p>When you're working on the other form and press enter it will click on the search button. I don't want this, I would prefer that when you press enter the button for the form is clicked.</p> <p>I tried using jQuery like this:</p> <pre><code>$('#textBoxId').keyup(function(e) { if(e.keyCode === 13) { $('#buttonId').click(); e.preventDefault(); } }); </code></pre> <p>But the form submitted, meaning that the client-side validation didn't run (ie, the onclick event handler wasn't run on the button).</p> <p>What's the best way to achieve this?</p>
asp.net javascript jquery
[9, 3, 5]
1,071,591
1,071,592
How to publish my c++ program to my android?
<p>I am new at this. I wrote a simple c++ program in eclipse. I was wondering how to get this app to run on my phone?</p>
android c++
[4, 6]
2,031,804
2,031,805
jQuery Modal Dialog - I must be missing a simple thing
<p>I have a php page that needs a modal confirmation.</p> <p>When clicking "Please confirm" on the dialog, I want the page post to continue. How in the world can I accomplish this?</p> <p>Here is my js code so far:</p> <pre><code> $(document).ready(function() { var $dialog = $('&lt;div&gt;&lt;/div&gt;') .dialog({ autoOpen: false, title: 'Are you sure?', modal: true, closeOnEscape: true, buttons: { "Please confirm": function() { // want to continue the post that was interrupted // by this dialog $("#account_mgr").submit(); $( this ).dialog( "close" ); }, Cancel: function() { $( this ).dialog( "close" ); window.location = "/account_mgr#MySubscription"; } } }); // $('#btnSubscription').click(function() { $('#btnSubscription').live('click', function() { $dialog.dialog('open'); return false; }); }); </code></pre>
php jquery
[2, 5]
3,285,277
3,285,278
Adding Value into an Input Field
<p>I am working on an iPhone Web App using HTML &amp; CSS. I have currently got the JavaScript/HTML5 Geolocation picking up my current location and showing me it on a Google Map using Lat &amp; Long values. I also want to add these Lat &amp; Long Values into the 'address' text field on the page so I can submit the details.</p> <p>Here is the link: <a href="http://m.belfi.co.uk/form.html" rel="nofollow">http://m.belfi.co.uk/form.html</a></p> <p>When I click 'find me' I would like the lat and long to be added to the 'address' input field. Have no idea how to do this though :(</p>
javascript jquery
[3, 5]
4,466,873
4,466,874
Jquery to populate input or textarea
<pre><code>&lt;div id="example"&gt;&lt;/div&gt; &lt;script type="text/javascript"&gt; jah = "&lt;p&gt;Browser CodeName: " + navigator.appCodeName + "&lt;/p&gt;"; jah+= "&lt;p&gt;Browser Name: " + navigator.appName + "&lt;/p&gt;"; jah+= "&lt;p&gt;Browser Version: " + navigator.appVersion + "&lt;/p&gt;"; jah+= "&lt;p&gt;Cookies Enabled: " + navigator.cookieEnabled + "&lt;/p&gt;"; jah+= "&lt;p&gt;Platform: " + navigator.platform + "&lt;/p&gt;"; jah+= "&lt;p&gt;User-agent header: " + navigator.userAgent + "&lt;/p&gt;"; document.getElementById("example").innerHTML=jah; &lt;/script&gt; </code></pre> <p>I'm using the above code to compile some browser info I need to collect from a form. How can I get that info passed to a Input or Textarea? </p> <p>Thanks in advance!</p>
javascript jquery
[3, 5]
5,890,045
5,890,046
jQuery - if Value = 1 fadeIn
<p>Is there any alternative to onKeyUp which says that if letter was typed do this because onKeyUp shift, enter, backspace etc counts. </p> <p>Something like if value.div1 = 1 fade in div2 for example.</p> <p>Thanks alot </p> <p>EDIT: Okay I wasn't clear. Sorry, what I meant is:</p> <p>I have a textarea. If letter is typed [not KeyUP,Keypress etc.] in the textarea then fadeIn div1. </p> <p>Sorry and thanks alot again</p>
javascript jquery
[3, 5]
2,568,306
2,568,307
Redirect on button click in alert-dialog
<p>I would like to show an alert box at the end of my code where the insert operation is complete. Is there an easy way to show some kind of alert box that says "Inserted successfully" and shows an OK-button. The click on "OK" should then redirect to a specific page.</p> <p>The code I'm using:</p> <pre><code>ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('Inserted Successfully')", true); </code></pre>
c# javascript asp.net
[0, 3, 9]
861,861
861,862
A jquery means to the end of changing every(as in each and all) href value to a corresponding array value
<p>my question is while vague, specific. I would like to know the simplest means of changing each and every (10+) anchor tags href value to a corresponding array item. the page in question being constructed from the bottom up meaning that each new post is above the last new post, so I have an array of links starting with the link that corresponds to the bottom most and thereby first placed and last in order post. so far (in theory) I think that a variable that returns each array value a reverse traversal of that array that is used in a function that selects and traverses each anchor tag would be the solution.</p> <pre><code>var standard_anchor = new Array(); standard_anchor[0] = "http://whatever.com/"; standard_anchor[1] = "http://www.egs.edu/faculty/jean-baudrillard/articles/simulacra-and-simulations-viii-the-implosion-of-meaning-in-the-media/"; var standard = $(function(){ //should return reversed iterated standard anchor array }); //// $('a [href]').each(function(){return (standard)}); </code></pre> <p>that's as much as I can imagine.</p>
javascript jquery
[3, 5]
1,404,612
1,404,613
Trying to do email validation but it isn't working as intended
<p>I'm just making some form validation with jQuery, this is the part for the email:</p> <pre><code>var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i; var email = $('#user_email'); $('#user_email').on('keyup change', function() { if ((email.val().length &lt;= 6) &amp;&amp; (re.test(email.val()))) { $('#alert_user_email').text('Email cannot be blank or invalid formation'); submit_btn.disabled = true; $('#alert_user_email').show(); } else { $('#alert_user_email').text(''); submit_btn.disabled = false; $('#alert_user_email').hide(); } }); </code></pre> <p>But for some reason it isn't working, everything works fine if I remove the <code>&amp;&amp; re.test</code>stuff from the <code>if</code> statement but isn't working as intended, any enlightenment would be great!</p>
javascript jquery
[3, 5]
3,951,690
3,951,691
How can i stream CCTV camera to iphone from windows
<p>I am trying to build an iphone app that connects to an IP camera. The IP camera is windows based to i need to create a server using c++ and then stream the video to the iphone app.</p> <p>Can anyone tell me the best way in going about this task. I am new to programming so a dummies type guide would help.</p> <p>Thanks</p> <p>Inam</p>
c++ iphone
[6, 8]
4,879,279
4,879,280
jQuery code not executing - iPhone
<p>Im using jquery in webview basically im calling jquery method inside the html string loaded inside the webview. problem is webview is loaded properly but method is getting executed. i tried putting breakpoints it's hard to see the execution inside the string.</p> <p>Thanks in advance.</p>
jquery iphone
[5, 8]
453,276
453,277
Why would jquery not pollute global namespace?
<p>It is said here:</p> <p><a href="http://briancrescimanno.com/2009/09/24/how-self-executing-anonymous-functions-work/" rel="nofollow">http://briancrescimanno.com/2009/09/24/how-self-executing-anonymous-functions-work/</a></p> <blockquote> <p>Take a look at the source code of jQuery and you’ll see that the whole library is wrapped in a single, self-executing function that is assigned to the jQuery global object.</p> </blockquote> <p>But since jQuery is GLOBAL object it does pollute global namespace or I miss something ?</p>
javascript jquery
[3, 5]