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 |
---|---|---|---|---|---|
3,978,687 | 3,978,688 | Characters replacement with array key/value | <p>I try to replace some specials characters (emojis) based on a replacement map.<br>
I wrote this piece of code but it still not work..</p>
<pre><code>var char_map = {
'■': 'e',
'♥': 'a',
'♦': 'm',
};
$.fn.map_replace = function() {
$(this).html(function(i, content) {
$.each(char_map, function(key, value) {
content = content.replace(key, value);
});
return content;
});
};
$(".comment").map_replace();
</code></pre>
<p><a href="http://jsfiddle.net/NaX6v/" rel="nofollow" title="jsFiddle">This code on jsFiddle</a></p>
<p>Thanks for helping :)</p>
| javascript jquery | [3, 5] |
4,216,708 | 4,216,709 | How would i implement swfobject in this jquery overlay? | <p><a href="http://stackoverflow.com/questions/1785762/how-to-add-a-full-sized-image-to-the-center-of-a-webpage-using-jquery/1787976#1787976">http://stackoverflow.com/questions/1785762/how-to-add-a-full-sized-image-to-the-center-of-a-webpage-using-jquery/1787976#1787976</a></p>
<p>The code the guy posted...</p>
| javascript jquery | [3, 5] |
1,317,710 | 1,317,711 | How change content value of pseudo :before element by Javascript | <p>I have the grap constructured by CSS, which is dynamically changes by JS. I show graph max value by pseudo element as:</p>
<pre><code>.graph:before {
content:""; //value that want set by JS
position:absolute;
top:0;
left:0;
}
</code></pre>
<p>That's why I need to set this value by JS. I tried <code>$(".graph:before").css("content", hh);</code> but it didn't help. How to get that value?</p>
| javascript jquery | [3, 5] |
3,702,391 | 3,702,392 | Keep the content after postback | <p>I have a ASPX page, on this page there are two dropdown list, one button and one gridview. When the pages is loaded,these two dropdown would bind data from sql server. Then you select items from these two dropdown list, then click Button A to get data from sql server based on these two dropdown list, rendering the data using gridview.
There is another Button, Button B. Then I click the Button B to do something, like send mail. But the page becomes the first time it's loaded, the content disappeared after postback. How can I keep the content after I click the Button B?</p>
<pre><code>void SendInvitationMail_Click(object sender, EventArgs e)
{
send mail here
}
void QueryButton_Click(object sender, EventArgs e)
{
try
{
SPSecurity.RunWithElevatedPrivileges(delegate() {
try
{
My SQL here to get data from sql server and bind the data to gridview
gridview.Databind()
}
catch(Exception ex)
{
HandleException(ex);
}
});
}
catch (Exception ex)
{
HandleException(ex);
}
}
</code></pre>
<p>After I click the Query Button, it would get bind the data to gridview, then I click the Send Mail button. I want to keep all the result even I click the Send Mail button.
Best Regards, </p>
| c# asp.net | [0, 9] |
3,791,663 | 3,791,664 | on dom ready append html element using jquery | <p>I have legacy database with holds beside rest html source which is used by a client to render some page snippets. I want to fetch all images inside <code>#mainNewsBody .news p</code> and to add link to that image <code>rel='superbox[image]'</code></p>
<p>Now it's </p>
<p><code><img src="http://www.mysite.com/images/DSCF1087.JPG" /></code> and it should be </p>
<p><code><img src="http://www.mysite.com/images/DSCF1087.JPG" rel='superbox[image]'/></code></p>
<p>how can I achive this using jquery on dom ready?</p>
<p>Thanks everyone.</p>
| javascript jquery | [3, 5] |
1,386,502 | 1,386,503 | jQuery: Problems with forcing jRumble plugin to stop rumble after delay, fake event? | <p>I'm using the jRumble plugin (http://jackrugile.com/jrumble) to rumble menu items on mouseover. However, the plugin has no setting for rumble time or number of rumbles, so it constantly rumbles until mouseout.</p>
<p>I'v tried like crazy to trigger "stoprumble" 1 second after hover but with no luck :/</p>
<p>This is how my code looks like right now, it works but does continious rumbling until mouseout.</p>
<pre><code>$('#menu a img').hover(function(){
$(this).trigger('startRumble');
}, function(){
$(this).trigger('stopRumble');
});
</code></pre>
<p>I'd need it to work something like this (which dont work):</p>
<pre><code>$(this).trigger('startRumble').delay(1000).trigger('stopRumble');
</code></pre>
<p>Any idea how i can accomplish a single rumble? Thanks in advance!</p>
| javascript jquery | [3, 5] |
3,314,644 | 3,314,645 | Session not ending on click of "OnLoggingOut" action | <p>I am trying to log out of a session on a website with the following code. However, seemingly nothing happens when I click on the logout button. </p>
<p>here is my code:</p>
<pre><code><asp:LoginStatus ID="LoginStatus1" OnLoggingOut="Logout_Click" runat="server" />
</code></pre>
<p>and c#: </p>
<pre><code>public void Logout_Click(object sender, EventArgs e)
{
Session.Abandon();
FormsAuthentication.SignOut();
FormsAuthentication.RedirectToLoginPage();
}
</code></pre>
<p>This code is not ending the session, and it isn't even redirecting to the login page. </p>
<p>Web.config:</p>
<pre><code><authentication mode="Forms" >
<forms loginUrl="url" timeout="20" domain="domain">
</forms>
</authentication>
</code></pre>
<p>Thanks guys!</p>
| c# asp.net | [0, 9] |
3,305,161 | 3,305,162 | Unable to make an image previewer by jQuery | <p>I know the <a href="http://stackoverflow.com/questions/439468/image-previewer-for-webpages">article</a> but it is not exactly what I want.</p>
<p><strong>How can you make an image previewer similar as at the <a href="http://www.incremental.ie/" rel="nofollow">website</a>?</strong></p>
| javascript jquery | [3, 5] |
2,464,411 | 2,464,412 | Javascript write underneath another element (on a new line) | <p>I need to create a function in JavaScript, that will write some text (which was retrieved with XMLHttpRequest) to a new element underneath the previous one.
To give you an example, imagine a chat room. When someone writes something new, a new line is created.</p>
<p>Also if possible how this would be in jQuery?
I want to see if in jQuery would be much easier.</p>
<p>If you need anymore information please let me know!
Thanks in advance.</p>
| javascript jquery | [3, 5] |
4,376,997 | 4,376,998 | Multiple generated dropdowns at run-time using one set of values | <p>I have a table of data which is part of a sample. I would like to assign each column to a different person so 'Kevin' would take column one, 'Bryan' would take column two, 'Cath' column three and so on. Once their name has been used I would like it to be removed from all other dropdowns and if a different person is selected I would like their name to reappear for selection in another dropdown.</p>
<p>There can be an infinite number of columns but never more than the number of people available so I don't have to worry about the dropdown running out of names.</p>
<p>I would like this doing on the fly using jQuery if possible. Has anybody got any example code that I could modify to fit?</p>
| javascript jquery | [3, 5] |
3,766,038 | 3,766,039 | Javascript Insert into Array | <p>I have javascript code some thing like this --</p>
<pre><code>var count=3;
var pl=new Array(count);
var il=new Array(count);
pl.push('<?php echo $var1; ?>');
il.push('<?php echo $var2; ?>');
</code></pre>
<p>Why is this not working?</p>
<p>But if I try some thing like this </p>
<pre><code>pl[0]='<?php echo $var1; ?>';
</code></pre>
<p>It works. Can some one point out the problem?</p>
<p>Thanks </p>
| php javascript | [2, 3] |
1,149,452 | 1,149,453 | jquery plugin problem | <p>I`m trying to figure out how to properly create jquery plugin. Here is what I do</p>
<pre><code>(function( $ ){
$.fn.myPlugin = function() {
console.log(this.eq(0).text());
};
})( jQuery );
$('#sector1').myPlugin();
</code></pre>
<p>Here is html</p>
<pre><code><div id="sector1">
<span class="timestamp">1</span>
</div>
<div id="sector2">
<span class="timestamp">2</span>
</div>
</code></pre>
<p>The problem is that I can't get the text of sector1 span tag.
How to do that ?</p>
| javascript jquery | [3, 5] |
3,752,495 | 3,752,496 | how can i make a dynamic drop down box in php? | <p>i need in an php file three drop down boxes or multiple select boxes.</p>
<p>the entries from these boxes are in a mysql database.</p>
<p>the single problem is that the entries in the thrid box depend on the second, and the entries in the second depend on the first.</p>
<p>can someone help? know any examples?</p>
| php javascript | [2, 3] |
3,509,051 | 3,509,052 | JQuery hover menu that works like a regular menu if the brower has javascript disable | <p>Is there a way to make this code not have the hover point links' pictures not come up if the browser has Javascript disable? And then have the links work like a regular hover point when Javascript is disable?</p>
<pre><code><script type="text/javascript" src="/Scripts/jquery-1.2.2.pack.js">
<script type="text/javascript">
$(function () {
// set opacity to nill on page load
$("ul#bnavmenu span").css("opacity", "0");
// on mouse over
$("ul#bnavmenu span").hover(function () {
// animate opacity to full
$(this).stop().animate({
opacity: 1
}, 'slow');
},
// on mouse out
function () {
// animate opacity to nill
$(this).stop().animate({
opacity: 0
}, 'slow');
});
});
</script>
</code></pre>
| javascript jquery | [3, 5] |
3,696,306 | 3,696,307 | how to get the element selected | <p>The dropdowns on the top right, I need to get the first three characters of the string of the type selected for example if the user selects Pizza Delivery i need the string "piz"</p>
<p>here is the <a href="http://posnation.com/pre_config/pre_config_step_3.php?type=Restaurant&count=1" rel="nofollow">url</a></p>
<pre><code> <div class="select-big select-small right">
<div class="select-holder">
<div class="button">
<div class="icon left"></div>
<p class="text left">Fast Food Pos System</p>
<a href="#" class="trigger right"></a>
<div class="cl">&nbsp;</div>
</div>
<div class="dropdown">
<ul>
<li><a href="#" class="icon-s icon-s1">Grocery</a></li>
<li><a href="#" class="icon-s icon-s2">Pizza Delivery</a></li>
<li><a href="#" class="icon-s icon-s3">Quick Service</a></li>
<li><a href="#" class="icon-s icon-s4">Retail</a></li>
<li><a href="#" class="icon-s icon-s5">Salon</a></li>
<li><a href="#" class="icon-s icon-s6">Bar</a></li>
</ul>
<div class="cl">&nbsp;</div>
</div>
</div>
</code></pre>
<p>here is the Jquery that I am working with </p>
<pre><code> $('.select-big ul li a').click(function () {
$(this).parents('.select-holder').find('.text').text($(this).text());
// I need the string here
</code></pre>
| javascript jquery | [3, 5] |
1,799,023 | 1,799,024 | Finding matching string from javascript array | <p>I have one array of strings. I need to find all strings starting with a key.
for eg: if there is an array <code>['apple','ape','open','soap']</code>
when searched with a key 'ap'
i should get 'apple' and 'ape' only and not 'soap'. </p>
<p>This is in javascript.</p>
| javascript jquery | [3, 5] |
1,403,448 | 1,403,449 | Detect click inside/outside of element with single event handler | <p>Suppose I have one div in my page. how to detect the user click on div content or outside of div content through JavaScript or JQuery. please help with small code snippet.
thanks.</p>
<p><strong>Edit</strong>: As commented in one of the answers below, I only want to attach an event handler to my body, and also want to know which element was clicked upon.</p>
| javascript jquery | [3, 5] |
3,011,274 | 3,011,275 | Google Chrome logo using Android | <p>I couldn't find a similar example as close as the Google chrome logo. I want to make this logo using Android, forget about the colors or exact design. Imagine the blue dot is an ImageView, the red,green and yellow are ImageButtons. I want an ImageView surrounded by 3 or 4 ImageButtons like this. All what I came up to is the Oval layout shape with ImageView centered. I only need a hint if anybody has.</p>
<p><img src="http://i.stack.imgur.com/wM8LU.jpg" alt="enter image description here"></p>
| java android | [1, 4] |
3,059,529 | 3,059,530 | How to check whether a certain asp.net text box exists in a page | <p>Suppose I have a master page where I have written some javascript to access the value of a particular asp.net text box, which resides in one of its content pages, but not in all the pages. This piece of javascript code can't be moved to that particular content page because of some restrictions.</p>
<p>Now I need a way to determine whether or not that text box exists in the page, which will imply that the content page containing that text box has been loaded.</p>
<p>How I can I do that in javascript?</p>
| asp.net javascript | [9, 3] |
2,966,054 | 2,966,055 | Creating Dynamic Menus | <p>I have to create dynamic menus from the database and can someone please help me in the code,Thanks in Advance .</p>
| c# asp.net | [0, 9] |
787,898 | 787,899 | Android: How to select text from WebView, and highlight it onclick | <p>Hi guys in my web app i wanted to print selected text(say here content in paragraph tag). How to do it in Android WebView, how to select text using JavaScript??<br><br>
Thanks in advance..<br><br>
Here is my JavaScript code</p>
<pre><code><script type="text/JavaScript">
function SelectText()
{
var txt = '';
if (window.getSelection)
{
txt = window.getSelection();
}
else if (document.getSelection)
{
txt = document.getSelection();
}
else if (document.selection)
{
txt = document.selection.createRange().text;
}
else return;
document.getElementById("demo").innerHTML= txt;
}
</script></head>
<body>
<p>Hi man how are you?? Hope your doing good..</p>
<p> id="demo"></p>
<button> onclick="SelectText()">Selected text</button>
</body>
</html>
</code></pre>
| javascript android | [3, 4] |
1,485,589 | 1,485,590 | php script to echo a post | <p>Could someone help with a simple PHP script to echo the whole message received with an HTTPPOST.</p>
<p>I am sending a string from an android app using HTTPPOST and would like to receive as a response the message received by the POST at the server.</p>
<p>The script that I am using will only echo name value pairs </p>
<pre><code>echo $_POST('data')
</code></pre>
<p>works when I post form data, but have not figured out how to echo a string. </p>
<p>Thanks</p>
| php android | [2, 4] |
4,872,284 | 4,872,285 | keeping the selected text browser highlight on all the time | <p>When some text on a document is highlighted, the default browser highlight is lost as soon as there is a click on the document.</p>
<p>I want to keep the browser highlight on all the time just like apture <a href="http://www.apture.com/" rel="nofollow">http://www.apture.com/</a>. Highlight some text, it will popup with a "Learn More" bubble, click on the "Learn More" button, it still won't lose the default browser highlight focus.</p>
<p>How do I do that?</p>
<p>I basically want to get the position of the selected text without adding a span AND keeping the browser highlight when clicked on a button.</p>
| javascript jquery | [3, 5] |
3,132,645 | 3,132,646 | Why can't I assign null to decimal with ternary operator? | <p>I can't understand why this won't work</p>
<pre><code>decimal? compRetAmount = !string.IsNullOrEmpty(txtLineCompRetAmt.Text)
? decimal.Parse(txtLineCompRetAmt.Text.Replace(",",""))
: null;
</code></pre>
| c# asp.net | [0, 9] |
3,590,869 | 3,590,870 | How to detect if the user clicked the "back" button | <p>When the user goes history-back-1...how do I detect that? And then, alert "the user clicked back!"</p>
<p>Using binds (and jquery preferably)</p>
| javascript jquery | [3, 5] |
2,965,193 | 2,965,194 | How to iterate through table with id='test' and get ids of each row inside table? | <p>How to iterate through table with id='test' and get ids of each row inside table using JQuery ?
I need to collect ids in array.</p>
| javascript jquery | [3, 5] |
230,559 | 230,560 | Jquery how to display error message when having 401 Unauthorized error? | <p>How do I display an error message for the 401 Unauthorized error?</p>
<p>My jquery:</p>
<pre><code>$('.ero').click(function(e) {
e.stopPropagation();
e.preventDefault();
$.ajax({
type: 'POST',
url: '/stem_op/3',
success:function(msg){
$('.warning').fadeIn(500).css({
display: 'block',
position: 'absolute',
left: position.left + 50,
top: position.top - 25
}).append(msg).addClass("active")}
});
});
</code></pre>
| javascript jquery | [3, 5] |
6,031,769 | 6,031,770 | Current position of Java Language Conversion Assistant and J# | <p><a href="http://stackoverflow.com/questions/1508019/identifying-code-that-compiles-in-both-java-and-c-but-runs-differently">A recent answer to a question on converting Java to C#</a> suggested I should use Java Language Conversion Assistant and pointed to:
<a href="http://msdn.microsoft.com/en-us/library/7tatw8a2%28VS.80%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/7tatw8a2%28VS.80%29.aspx</a></p>
<p>I cannot find JLCA on my Visual Studio (9.0.30729.1) and on looking at Wikipedia (<a href="http://en.wikipedia.org/wiki/J%5FSharp" rel="nofollow">http://en.wikipedia.org/wiki/J%5FSharp</a>) I find:</p>
<blockquote>
<p>Retirement of the J# language and Java
Language Conversion Assistant from
future versions of Visual Studio,
since the existing J# feature set
largely meets customer needs and usage
of J# is declining. The last version
shipping with Visual Studio 2005 will
be supported until 2015 as per the
product life-cycle strategy.</p>
</blockquote>
<p>I'd be grateful for an overview of whether I can use and should be using either J# or JLCA and if so how to install and use them.</p>
| c# java | [0, 1] |
1,105,386 | 1,105,387 | Deselect Checkbox | <p>I want to deselect the checkboxes that are in disabled state using JQuery</p>
<p>I used live type with 'change' event in Jquery. The following code deselects all checkboxes. But I need only for disabled checkboxes.</p>
<pre><code>$('.checkboxGroups').removeAttr('checked').trigger('change');
</code></pre>
<p>Thanks.</p>
| jquery asp.net | [5, 9] |
3,509,847 | 3,509,848 | Use jQuery on Event, instead of automatic upload on plugin file-uploader | <p>I'm using this pluging to upload files: <a href="https://github.com/valums/file-uploader" rel="nofollow">https://github.com/valums/file-uploader</a></p>
<p>But now I starts the upload as soon as you have choosen a file. </p>
<p>See demo <a href="http://valums.com/files/2010/file-uploader/demo.htm" rel="nofollow">http://valums.com/files/2010/file-uploader/demo.htm</a></p>
<p>Would anybody be able to point me in the right direction so that I disable the auto submission but instead use preferable a jQuery command with a button</p>
<p>something like</p>
<pre><code>$('button').on('click', function() {
....Now run start the upload...
});
</code></pre>
| javascript jquery | [3, 5] |
5,073,599 | 5,073,600 | how to create the image dynamically in ASP.NET? | <p>how to create the image dynamically based on the points i get from table</p>
<p>if point =1</p>
<p>my image must be displayed once,</p>
<p>if point=2</p>
<p>imgae has to be display twice.... in that way</p>
| c# asp.net | [0, 9] |
1,308,963 | 1,308,964 | add image dynamiacally based on count in ASP.NET | <p>suppose I have 5 check boxes. Based on number of check box checked I have to add image and hyper-link to images. (i.e if I have checked 2 check box I have to load only 2 image and link to those 2 loaded images, in-case of 3 check box checked, 3 images needs to be loaded and link to those 3 loaded images).</p>
<p>Is there any possible way that I can do that in asp.net using c#?</p>
| c# asp.net | [0, 9] |
3,932,692 | 3,932,693 | jquery dymaic loading of external script files before $(document).ready() | <p>Currently i have jqueryUI.js file referenced through the <code><script></code> tag<br/>
I have several $(document).ready() functions, which uses, jquery ui functions.</p>
<p>I am trying to load jqueryUI.js file dynamically using $.getScript</p>
<p>I tried the following code.</p>
<pre><code>Var scriptCntr = 0;
$(document.ready(function(){
scriptCntr ++;
$.getScript(path, function (data, textStatus) {
scriptCntr --;
});
while(scriptCntr!=0){
}
});
</code></pre>
<p>on the top of the page.
The idea is to make the $(document).ready() wait till the file is downloaded. But the logic goes to the WaitLoop and stays there infinitely. And the file wouldnt download, unless all the $(document).ready() is executed. </p>
<p>Is there a way to download the jqueryUI.js file before the first $(document).ready() is executed?</p>
<p>Thanks in Advance.</p>
| javascript jquery | [3, 5] |
3,691,497 | 3,691,498 | .click() in a <div> in a <div> does not work | <pre><code>$('#A').click(function () {
$('#A1').prepend('<div class="AcL" id=' + i + '>Hello<span class="RmMe" id="' + i + '" style="margin-left:20px; cursor:pointer;">X</span></div>');
i++;
});
$('.RmMe').click(function () {
alert("OK");
});
<div id="A1"></div>
</code></pre>
<p>Any idea why the click is not working?</p>
| javascript jquery | [3, 5] |
5,610,981 | 5,610,982 | “does not contain a definition for ...and no extension method ...accepting a first argument for type error | <p>I've got the following error:</p>
<pre><code>'DirectActivity' does not contain a definition for 'ddl_jobcode_Id2' and no extension method 'ddl_jobcode_Id2' accepting a first argument of type 'DirectActivity' could be found (are you missing a using directive or an assembly reference?)
</code></pre>
<p>In my aspx, I created a DropDownList like this:</p>
<pre><code><asp:DropDownList ID="ddl_jobcode_Id2" runat="server" DataSourceID="ddl_ActivityType2"
DataTextField="jobCode" DataValueField="ID" SelectedValue='<%# Bind("jobCode_ID2", "{0}") %>'
OnDataBound="ddl_jobcode_Id2_DataBound"
onselectedindexchanged="ddl_jobcode_Id2_SelectedIndexChanged1"
AutoPostBack="True">
</asp:DropDownList>
</code></pre>
<p>I need to add a control so that in the .cs file I worte </p>
<pre><code>protected void ddl_jobcode_Id2_SelectedIndexChanged1(object sender, EventArgs e)
{
if(this.ddl_jobcode_Id2.SelectedValue == "19" )
{ ...}}
</code></pre>
<p>and it just shows this error on <code>ddl_jobcode_Id2</code></p>
<p>could anyone help me please? many thanks!!!</p>
| c# asp.net | [0, 9] |
4,108,629 | 4,108,630 | jQuery not getting the password field value | <p>I have searched a lot in stackoverflow and other sites and got many solutions but nothing solved mine.That is why I am posting this.I have a password field in my web page, which was created dynamically on a link click.And I want to get the value typed in that password field into a variable when it loses focus.For that i created a jQuery function like this.</p>
<pre><code>$('#parentdiv').on('focusout', '#passwordfield', function() {
var pass1 = $('#passwordfield').val();
alert(pass1);
alert("Hello");
});
</code></pre>
<p>Here the first alert command will displayed with nothing, but the second alert come with "Hello". Which means, when the password field loses its focus this function executes without any problem, but the problem is, it is not getting the password field value.</p>
<p>Please help me to solve this problem.</p>
<p><strong>EDIT</strong></p>
<p>This is my html</p>
<pre><code><input type="password" size=20 id="passwordfield" />
</code></pre>
| javascript jquery | [3, 5] |
1,249,344 | 1,249,345 | Hide a div on mouseover | <p>I am creating a slideshow using jquery based on the code given here - <a href="http://snook.ca/archives/javascript/simplest-jquery-slideshow" rel="nofollow">http://snook.ca/archives/javascript/simplest-jquery-slideshow</a></p>
<p>This is the sample code: </p>
<pre><code><html>
<head>
<style>
.fadein { position:relative; width:500px; height:332px; }
.fadein img { position:absolute; left:0; top:0; }
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$('.fadein img:gt(0)').hide();
setInterval(function(){
$('.fadein :first-child').fadeOut()
.next('img').fadeIn()
.end().appendTo('.fadein');},
3000);
});
</script>
</head>
<body>
<div class="fadein">
<img src="http://farm3.static.flickr.com/2610/4148988872_990b6da667.jpg">
<img src="http://farm3.static.flickr.com/2597/4121218611_040cd7b3f2.jpg">
<img src="http://farm3.static.flickr.com/2531/4121218751_ac8bf49d5d.jpg">
</div>
<a href="#"><img id="try" src="http://freeimagesarchive.com/data/media/29/12_sky.jpg" /></a>
</body>
</html>
</code></pre>
<p>What I want is, when I hover over the image with the id try, the slideshow should get hidden for a certain duration and show a static image instead and regains the slideshow after few moments..I am pretty novice in jquery, can someone help me out in this??
Thanx..</p>
| javascript jquery | [3, 5] |
2,371,391 | 2,371,392 | Triggering a jquery action when the users mark a Checkbox | <p>im very new in javascript and jquery. I have this checkbox:</p>
<pre><code><label for="editable">Editable </label><input name="editable" type="checkbox" id="edita"/>
</code></pre>
<p>And this jquery action:</p>
<pre><code>$('#slickbox1').toggle(400);
return false;
</code></pre>
<p>I want to execute that action when the checkbox is checked. Thanks!</p>
| javascript jquery | [3, 5] |
4,247,706 | 4,247,707 | unable to add textboxes to listbox | <p>hi I want to add textboxes to a listbox with everyclick on the add button.
so here are my codes</p>
<pre><code>this.ListBox1.Controls.Add(TB);//TB is the name of my TextBox and it has been defined and initialized
</code></pre>
<p>I even tried to use Addat </p>
<p>there are no errors but it doesnt work</p>
| c# asp.net | [0, 9] |
246,313 | 246,314 | how to replace javascript '\' with another char | <p>i have a var in javascript that looks like this: </p>
<pre><code>C:\docs\path\file.exe
</code></pre>
<p>how can i replace \ with another char like ?
so the var becomes </p>
<pre><code>C:?docs?path?file.exe
</code></pre>
<p><strong>edit</strong><br>
i am trying to find the size of a file in JS. the only way i managed to do it, is to call a [WebMethod] using $ajax. when i try to send the path as it is, i get an escape character error, so i chose to replace '\' by '?' and then the [WebMethod] replaces '?' with '\' check the file size and returns it.</p>
| c# javascript | [0, 3] |
4,619,281 | 4,619,282 | Character encoding error | <p>Using asp.net pages with master page and getting error: </p>
<blockquote>
<p>The character encoding of the plain text document was not declared.
The document will render with garbled text in some browser
configurations if the document contains characters from outside the
US-ASCII range. The character encoding of the file needs to be
declared in the transfer protocol or file needs to use a byte order
mark as an encoding signature</p>
</blockquote>
<p>If master page is not apply on the content page then page working fine.
Please provide some solution for this issue.</p>
| c# asp.net | [0, 9] |
5,357,599 | 5,357,600 | Can PHP and C++ pass data between each other? | <p>I have a lot of mathematical calculations in my PHP script, which can be quite slow at times. I'm wondering if it's possible to pass data from PHP to C++, do the calculations in C++, then pass the results back to PHP?</p>
<p>P.S. I'm not very good at C++.</p>
| php c++ | [2, 6] |
1,966,648 | 1,966,649 | redirect to specific page based on db value | <p>I have a form which is like the login form ,,, the idea is the user enter his first name and last name and I need to check if the gender is male it will redirect to a male.aspx and if the gender is female it will redirect to female.aspx, and if firstname and lastname are wrong or not match or not exist he will go back to the same form again.</p>
<p>I did the main code but I don’t know how to check gender to redirect to the page</p>
<p>Also I want to show the full name (First & last name) in the next page.</p>
<p>Here is my code. Hope I get help.</p>
<pre><code>protected void log_Click(object sender, EventArgs e)
{
SqlDataSource sds = new SqlDataSource();
sds.ConnectionString = ConfigurationManager.ConnectionStrings["myDbConnectionString1"].ToString();
sds.SelectParameters.Add("firstname", TypeCode.String, this.firstname.Text);
sds.SelectParameters.Add("lastname", TypeCode.String, this.lastname.Text);
sds.SelectCommand = "SELECT * FROM [myTb] WHERE [firstname] = @firstname AND [lastname] = @lastname";
DataView dv = (DataView)sds.Select(DataSourceSelectArguments.Empty);
if (dv.Count == 0)
{
this.lblmsg.Text = "Invalid firstname and lastname!";
return;
}
else
{
Response.Redirect("home.aspx");
}
}
</code></pre>
| c# asp.net | [0, 9] |
1,946,971 | 1,946,972 | Jquery Popup gets hidden behind editlive editor | <p>In my application I have used EditLive Editor. When I try to open a popup on the same page where edtor is present it gets hidden behind it. Could anyone please help me how can i get my jquery dialog over the eitor. </p>
<p>Thanks</p>
| javascript jquery | [3, 5] |
4,888,796 | 4,888,797 | Why i am getting multiple images while using Function() in jquery | <p>I use the following Jquery for calendar <a href="http://keith-wood.name/datepick.html" rel="nofollow">http://keith-wood.name/datepick.html</a></p>
<p>My source is as follow</p>
<pre><code><script type="text/javascript">
$(function()
{
$('#ctl00_ContentPlaceHolder1_textbox1').datepick({showOnFocus: false, showTrigger: '#calImg'});
});
</script>
<asp:TextBox ID="textbox1" runat="Server">
</asp:TextBox>
<img src="calendar.gif" alt="Popup" id="calImg" class="trigger" />
</code></pre>
<p>But i am getting multiple images when i see on my browser why this is happening</p>
<p><img src="http://i53.tinypic.com/2v0ykd1.png" alt="Link"></p>
| jquery asp.net | [5, 9] |
4,665,631 | 4,665,632 | Function doesn't work as it should in IE7 & IE8 when invoked from a setTimeout | <p>I've got this crazy javascript issue with IE7 and IE8. The function expression below loads some images. That's it. quite simple. When the function is invoked directly ie <code>testmypatience()</code> it works as it should but if I call it from inside a timeout it won't load the images. The function is invoked but the images won't load. It also fails to work when invoked by the jQuery animate callback. </p>
<p>I've tried everything and i can't get it to work so you help would be most appreciated.</p>
<pre><code>var testmypatience = function($active){
var arr = ['images/site/products-medium/m_cordial_pomegranateelderflower.png', 'images/site/products-medium/m_cordial_spicedberry.png', 'images/site/products-medium/m_cordial_strawberryelderflower.png', 'images/site/products-medium/m_750presse_coxsapple.png', 'images/site/products-medium/m_party_appleandelderflower.png', 'images/site/products-medium/m_squeezy_blackcurrentandapple.png', 'images/site/products-medium/m_270presse_cranberryandorange.png', 'images/site/products-medium/m_270presse_elderflower.png', 'images/site/products-medium/m_270presse_gingerlemongrass.png'];
for (i = 0; i < arr.length; i++) {
var img, len;
img = new Image();
img.src = arr[i];
img.onload = function(){
console.log('done ' + this.src);
}
}
}
//this works
testmypatience()
//None of these work
setTimeout(function(){
testmypatience()
}, 400)
setTimeout(testmypatience, 400)
jQuery('elm').animate({left:'1000px'},
{
duration:200,
complete: testmypatience
});
</code></pre>
| javascript jquery | [3, 5] |
910,718 | 910,719 | how to clear browser cache and history via javascript | <p>how to clear browser cache and history via javascript
I found some links like:-</p>
<p><a href="http://stackoverflow.com/questions/12671371/how-to-clear-browser-history-oan-clear-cache">How to clear browser history oan clear cache?</a></p>
<p><a href="http://stackoverflow.com/questions/13622460/how-to-clear-browser-hash-history-in-javascript">how to clear browser hash history in javascript</a></p>
<p>but they do not properly described on how this can be achieved via javascript ( or jQuery)</p>
<p>I require this so that the user do not have to do a [Ctrl+F5] or manually clear cache
and the most recent version of javascript file is loaded in the browser.</p>
<p>The main aim is to load the latest javascript files every time the user visits the website.
My application in ASP.NET MVC based and javascript files are included in .csHtml file.</p>
| javascript jquery | [3, 5] |
4,902,396 | 4,902,397 | Keep checked items at top of list | <p>I'm trying to create a checklist that will sort checked items to the top of the list, and when an item is unchecked, it will move below the checked items. Beyond the checked/unchecked sort, items should stay in their original order, regardless of what order they are checked in.</p>
<p>In other words, a five item list should always look like this:<br />
* two<br />
* three<br />
one<br />
four<br />
five<br /></p>
<p>not this:<br />
*three<br />
*two<br />
one<br />
four<br />
five<br /></p>
<p>I've seen examples of how to move clicked items to a specific position in the list, but nothing that takes into account the state of other items in the list.</p>
<p>Ideally I'd also like to animate the transition. Also, is there a way to remember the checked state across multiple pages?</p>
<p>This is the HTML I'm starting with:</p>
<pre><code><form>
<ul>
<li><label for="one"><input type="checkbox" id="one" />One</label></li>
<li><label for="two"><input type="checkbox" id="two" />Two</label></li>
<li><label for="three"><input type="checkbox" id="three" />Three</label></li>
<li><label for="four"><input type="checkbox" id="four" />Four</label></li>
<li><label for="five"><input type="checkbox" id="five" />Five</label></li>
</ul>
</form>
</code></pre>
| javascript jquery | [3, 5] |
888,539 | 888,540 | Next button + Javascript form manipulation result in problem on iPhone | <p>I have got a form with 2 dropdown lists on a simple HTML page. Depending on the value selected in the first dropdown list, a Javascript event handler(using the onChange event) changes the options of the second dropdown list.</p>
<p>When selecting a value in the first box and touching the second box in the browser window everything works fine, but when I use the "next" button provided by the dropdown-list-thing of Mobile Safari, only the rendered list changes, but the dropdown-list-thing shows still the old values. How can I fix this?</p>
<p>thanks in advance</p>
| javascript jquery iphone | [3, 5, 8] |
5,785,330 | 5,785,331 | kangamodeling and displaying graphs fails | <p>`Have you any idea why the following code snip I use doesn't produce the expected graph on the browser ?</p>
<p>I have added script tag pointing to latest jquery and kangamodeling's js scripts already.</p>
<p><a href="http://jsfiddle.net/y94Qy/" rel="nofollow">http://jsfiddle.net/y94Qy/</a></p>
<p>Thank you for any instructions.</p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
1,318,892 | 1,318,893 | How to get HiddenField control in Masterpage and set it's value? | <p>I have a <code>MasterPage</code> that contains a hidden field control. I want to get the current value of the hidden field and set the value of it from pages that use the <code>MasterPage</code>. </p>
<p>I have the following code so far: (in one of the pages)</p>
<pre><code> //Get the textbox and set it's value
TextBox txt1 = new TextBox();
txt1 = (TextBox)this.Master.FindControl("txtHiddenField");
txt1 .Text = "true";
</code></pre>
<p>The above code does not seem to work. What code would I need to get the hidden field control and set it's value? (and get it's value)</p>
| c# asp.net | [0, 9] |
2,371,145 | 2,371,146 | Initiating jQuery scripts after ajax loading without callback | <p>I know that jQuery has <code>.on()</code> and <code>.delegate()</code> methods, but these require the event to bubble. I want to load slickGrid and some other 'on load' plugins. </p>
<p>Is there anyway to call these without having to define them in the callback after an ajax request has loaded the new dom?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
6,021,659 | 6,021,660 | find out if a id has certain text and then change it | <p>I need to something like this</p>
<pre><code>if($('#ctl00_lblNoResults').text('Please select')){
$('.otherprop').text('Thanks')
}
else {
$('.otherprop').text('No Thanks')
}
</code></pre>
<p>So i have a layer like so</p>
<pre><code><div id="ctl00_lblNoResults">Don't select</div>
</code></pre>
<p>And another bit of text</p>
<pre><code><div class="otherprop">No Thanks</div>
</code></pre>
<p>I need to change the text of "otherprop" if "ctl00_lblNoResults" equals this</p>
<pre><code><div id="ctl00_lblNoResults">Please select</div>
</code></pre>
<p>to</p>
<pre><code><div class="otherprop">Thanks</div>
</code></pre>
<p>So desired results are</p>
<pre><code><div id="ctl00_lblNoResults">Don't select</div>
<div class="otherprop">No Thanks</div>
</code></pre>
<p>or</p>
<pre><code><div id="ctl00_lblNoResults">Please select</div>
<div class="otherprop">Thanks</div>
</code></pre>
<p>Hope this makes sense</p>
<p>Thanks</p>
<p>Jamie</p>
| javascript jquery | [3, 5] |
1,504,655 | 1,504,656 | To show checkboxes in a particular row on button click | <p>I have a gridview with a linkbutton in each row,on link button click,I want to show checkboxes for the cells in that particular row in which button is clicked,also want to keep them(checkboxes) checked or unchecked according to value in that particular cell.</p>
<p>Please need urgent help.</p>
<p>Thanking you.. </p>
| c# javascript jquery asp.net | [0, 3, 5, 9] |
4,509,678 | 4,509,679 | JQuery submit button doesn't fire | <p>I have the following code but it doesn't fire or doesn't show any error when I click on the save button. Could you please let me know what could be the problem? Thank you.</p>
<pre><code><script type="text/javascript">
$(document).ready(function () {
$('input[id*=btnSave]').click(function () {
var txtFirstName = $('input[id*=txtFirstName]').val();
var txtLastName = $('input[id*=txtLastName]').val();
var errMsg = '';
var errMsg = "<ul>";
if (txtFirstName == '') {
errMsg = errMsg + "<li>First Name is required</li>";
return false;
}
if (txtLastName == '') {
errMsg = errMsg + "<li>Last Name is required</li>";
return false;
}
errMsg = errMsg + "</ul>";
});
});
</script>
<telerik:RadTextBox ID="txtLastName" runat="server" />
<telerik:RadTextBox ID="txtFirstName" runat="server"/>
<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click"></asp:Button>
</code></pre>
| jquery asp.net | [5, 9] |
2,678,952 | 2,678,953 | Don't run Javascript function until custom font downloaded? | <p>Is there a way to not run a Javascript function until after a custom css font resource is downloaded.</p>
<p>I am displaying code in a <pre> and using the custom downloaded font Liberation Mono. The <pre> is also using custom scrollbars. The custom scrollbars Javascript (flexcroll) needs a static width set when setting up. But I can't know the width until the Liberation Mono font is downloaded.</p>
<p>The CSS to load the font is below (complete with smilie-face syntax):</p>
<pre><code>@font-face {
font-family: 'LiberationMonoRegular';
src: url('liberationmono-regular.eot');
src: local('☺'),
url('liberationmono-regular.woff') format('woff'),
url('liberationmono-regular.ttf') format('truetype'),
url('liberationmono-regular.svg#webfontkIKtf5pm') format('svg');
font-weight: normal;
font-style: normal;
}
</code></pre>
<p>The Javascript function I would like to do is something like the following. I'm taking a shot in the dark, and really don't think this is possible..</p>
<pre><code>$(function() {
waitForFontExists('LiberationMonoRegular', function() {
<do something>
});
});
</code></pre>
| javascript jquery | [3, 5] |
4,447,485 | 4,447,486 | time count after registry | <p>I saw some website that after you have registered, you can use the service like posting a comment immediately.</p>
<p>You may have to wait for 5 or 10 minutes to be able to start, like this StackOverflow website.</p>
<p>Once you have asked question, you have to wait 20 minutes to select your answer.</p>
<p>If I want to do it in JavaScript or PHP can anyone show me how to do it? I assume you have to compare the time with current time-stamp, but don't know how to exactly implement it. Thanks in advance!</p>
| php javascript jquery | [2, 3, 5] |
115,551 | 115,552 | Cannot call method 'click' of undefined | <p>I am trying to implement a jQuery 'slide toggle'. At the top of the page (in the header) I have included:</p>
<pre><code><script src="http://code.jquery.com/jquery-latest.js"></script>
</code></pre>
<p>Then the code of the area is:</p>
<pre><code><a href="#" id="morebutton" class="more">More</a>
<div class="toggler">
<div id="morepanel" class="ui-widget-content ui-corner-all">
<p>Text</p>
</div>
</div>
<script src="js/toggle.js" type="text/javascript"></script>
</code></pre>
<p>The toggle.js contains:</p>
<pre><code>$('#morebutton').click(function () {
$('#morepanel').slideToggle('slow', function () {
// Animation complete.
});
});
</code></pre>
<p>When I click it I get the error:</p>
<blockquote>
<p>Toggle.js:1Uncaught TypeError: Cannot call method 'click' of undefined.</p>
</blockquote>
<p>I can't at all figure out what to do. The divs are nested within further divs, and content holders, etc, but I can't see why this would be an issue.</p>
| javascript jquery | [3, 5] |
4,924,001 | 4,924,002 | extract info from a string | <p>Suppose I have a string that looks like the following:</p>
<pre><code>string foo ="<add key="key1" Value="val1"/>
<add key="key2" Value="val2"/>
<add key="key3" Value="val3"/>"
</code></pre>
<p>frrom this string i need to loop through and get every key value pair and do something with them.
how can i do that?</p>
<p>thanks</p>
| c# asp.net | [0, 9] |
4,872,341 | 4,872,342 | fadein() and fadeout() using with setinterval() | <p>hello freinds how can i make folowing code working with <code>fadein()</code> <code>fadeout()</code> effect
i want the every next number come with <code>fadein()</code> effect and current number go with <code>fadeout()</code> effect . can i make it in loop .. like if last number is <code>fadeout()</code> after that first number is <code>fadein()</code> . like loop</p>
<pre><code><script>
var counter = 1;
$(function() {
incrementCounter();
});
function incrementCounter() {
$('#fade').html(counter);
counter++;
if (counter < 4) {
setTimeout(incrementCounter, 2000);
}
}
</script>
</code></pre>
| javascript jquery | [3, 5] |
4,340,619 | 4,340,620 | How do I make an input radio button checked...using JQuery? | <pre><code><input type="radio" name="sort" value="2" id="myradio">
</code></pre>
<p>How do I make this checked in JQUERY?</p>
| javascript jquery | [3, 5] |
1,466,282 | 1,466,283 | Possible to 'layer' Android applications? | <p>I know this in general is beyond the scope of SO, but I am looking for some basic yes/no info to see if it is even feasible to proceed... I am thinking about building and Android 'note-taking/annotation' app that runs 'over' other installed Android apps, such as the web browser for example.</p>
<p>Essentially, while the user is browsing, my app would be running in the bg as a service, and then they could activate it which would then essentially intercept user inputs and translate those on a transparent canvas over the web browser into lines, shapes, etc. The user could then take a screen-cap of their marking with the underlying web page, which would be stored to the sd card.</p>
<p>I haven't seen any tutorials, etc on this kind of app interaction, and just wondering if it is even possible.</p>
<p>Thanks for any info!</p>
| java android | [1, 4] |
4,208,430 | 4,208,431 | Call a function of parent aspx page from web user control | <p>i have a aspx page on it i'm dynamically adding the web user controls in a placeholder. and know i have cancel button on the one user control and on click of that Cancel button i want to load other user control inside the aspx page (placeholder).</p>
<p>how can i do that, if i create an event handler in usercontrol then that become null.</p>
<p>thanks</p>
| c# asp.net | [0, 9] |
6,017,023 | 6,017,024 | PHP and Javascript code needed to check if form fields are not empty | <p>Javascript needed to prevent form submit if any of field is empty. all my form fields start names start with name=add[FieldName] those are the fields that need checking.</p>
<p>PHP, backend check before submiting to database double check to make sure all $POST are not empty</p>
| php javascript | [2, 3] |
5,622,321 | 5,622,322 | javascript variable problem when sending data via jQuery $.post() function | <p>i have a problem when i want to send input data via jQuery $.post</p>
<p>i have this input:</p>
<pre><code><input id="mydata" value='<?php echo $data; ?>' >
</code></pre>
<p>and i want to send it's data via jQuery $.post() function. </p>
<p>this $.post function runs but don't send anything:</p>
<pre><code>var the_data = $('#mydata').val();
//alert(the_data); has correct data!!
$.post("http://php/server", the_data , function(data){
alert(data);
}, "html");
</code></pre>
<p>but this one sends data correctly:</p>
<pre><code>$.post("http://php/server", <?php echo $data; ?> , function(data){}, "html");
</code></pre>
<p>i should use input for saving data and method 2 isn't suitable for me.</p>
| php jquery | [2, 5] |
3,258,300 | 3,258,301 | Convert AM/PM time to 24 hours format? | <p>I need to convert 12 hours format time (am/pm) to 24 hours format time, e.g. 01:00 PM to 13:00 using c# code. Please reply.</p>
<p>Thanks in advance,
NM</p>
| c# asp.net | [0, 9] |
5,754,055 | 5,754,056 | jquery $(td) exclude colspan? | <p>Hi. I have the following that adds a class to all <code><td></code> elements, however I have a particular <code><td colspan="3"></code> and I want to exclude it. How do I do this in jquery? Thanks for any help.</p>
<pre><code>$('td', table).addClass('ui-widget-content'); // exclude a <td colspan="3">
</code></pre>
| javascript jquery | [3, 5] |
5,803,964 | 5,803,965 | specific e-mail pattern control with javascript | <p>I've a textBox control and would like my users to <em>only</em> be able to enter <code>[email protected]'</code> or <code>'[email protected]'</code></p>
<p>How can I do this with a JavaScript function? The function must take a textbox value.</p>
| javascript jquery | [3, 5] |
2,748,877 | 2,748,878 | jQuery has conditional | <p>Trying to write a conditional with jQuery that basically states, if <code>div.gathering</code> does not contain <code>a.cat-link</code> then do the following. I have tried the following but it doesn't seem to work. Can anyone shed some light on this?</p>
<pre><code>if($("div.gathering:contains('a.cat-link')")){
$(".gathering").append("<a href='#"+data[i]["categories"][0]["category_id"]+"div' class='cat-link' id='"+data[i]["categories"][0]["category_id"]+"' rel='external'>"+data[i]["categories"][0]["category_name"]+"<br />");
}
</code></pre>
| javascript jquery | [3, 5] |
3,176,294 | 3,176,295 | Android record Voice in Mp3 format | <p>I i am going to record voice but i need in the format of MP3
please any one can help me to save Recorded Data in MP3 format.</p>
<p>currently i am using AudioRecord class in Android but saving with Wave Header format.</p>
<p>but i need to save as MP3.</p>
| java android | [1, 4] |
2,072,163 | 2,072,164 | javascript for image resize is not working in IE? | <p>The below given code resizes an image to 160x160 and works fine for Firefox & Chrome but not for Internet Explorer. Why?</p>
<pre><code>$(document).ready(function() {
$('#imagePreview img').each(function() {
$('#imagePreview img').each(function() {
var maxWidth = 160; // Max width for the image
var maxHeight = 160; // Max height for the image
var ratio = 0; // Used for aspect ratio
var width = $(this).width(); // Current image width
var height = $(this).height(); // Current image height
// Check if the current width is larger than the max
if(width > maxWidth){
ratio = maxWidth / width;
$(this).css("width", maxWidth); // Set new width
$(this).css("height", height * ratio); // Scale height based on ratio
height = height * ratio; // Reset height to match scaled image
width = width * ratio; // Reset width to match scaled image
}
// Check if current height is larger than max
if(height > maxHeight){
ratio = maxHeight / height;
$(this).css("height", maxHeight); // Set new height
$(this).css("width", width * ratio); // Scale width based on ratio
width = width * ratio; // Reset width to match scaled image
}
});
});
});
</code></pre>
| javascript jquery | [3, 5] |
5,542,531 | 5,542,532 | How can I trim the text in <asp:label within .ascx up to a "-" delimiter symbol? | <p>I only have access to the .ascx file and not codebehind.</p>
<p>I want to be able to display only the left portion of a string returned by a <code><asp:label</code> control.</p>
<p>I've thought about styling the label as <code>display:none</code>; and addind a second <code><asp:label</code> and setting the text property from the hidden control with some javascript manipulation but I can't work out how?</p>
<p>Any ideas? </p>
| javascript asp.net | [3, 9] |
5,743,867 | 5,743,868 | Incorrect button width and height | <p><a href="http://jsbin.com/iwimaw/5" rel="nofollow">Take a look a this</a>. I'm accessing the button's height and width using jquery's methods, and via accessing <code>.css("height")</code>, and I get two wrong answers.</p>
<p>I'm at 100% browser zoom. What's going on here?</p>
<pre><code>Inner Height: 46, Inner Width: 196
Height: 46, Width: 196
CSS Height:44px, CSS Width: 184px
(The actual button dimensions are 200 X 50)
</code></pre>
| javascript jquery | [3, 5] |
2,556,736 | 2,556,737 | Javascript VS C# | <p>Maybe a strange and green question, but</p>
<p>Is there anything C# can't do what javascript can...
And considering JQuery?</p>
<p>except for the fact that one is clientside, and the other serverside?
Or am I asking a very stupid question now?</p>
<p><strong>EDIT:</strong>
to be more specific: I mean web programming, and indeed maybe a more useful question is:</p>
<p><strong>> What can I do client side that I can't do server side, and vice versa?</strong></p>
<p><strong>> Are there more reasons to use both languages if you keep "server/clientside" out of scope?</strong></p>
<p><strong>> some developers avoid javascript. why?</strong></p>
| c# javascript | [0, 3] |
5,354,057 | 5,354,058 | How can I split data read from a json file? | <p>I have this json data in <code>data.json</code> file.</p>
<pre><code>[
"1009 2000",
"1009 2001",
"1002 2002",
"1003 2002"
]
</code></pre>
<p>I am looping through this data and spliting the data based on <code>,</code> as in the following code</p>
<pre><code>var show = function () {
var span = $('.input');
var c = $('ul');
$.getJSON('data/data.json', function (id) {
var j = id.split(',');
var hsl = j[0];
var ny = j[1];
$('<li>' + id + '</li>').appendTo(c);
$(c).appendTo(span);
console.log(hsl);
});
}
</code></pre>
<p>but this gives me this error in console</p>
<pre><code>Object 1009 2000,1009 2001,1002 2002,1003 2002 has no method 'split'
</code></pre>
<p>How can I split this data so that I could display it like this</p>
<pre><code> 1009 2000
1009 2001
1002 2002
1003 2002
</code></pre>
| javascript jquery | [3, 5] |
499,082 | 499,083 | How can I create a video preview thumbnail? | <p>I want to create the effect when a user hovers over a thumbnail of a video it will preview the video by showing a certain number of frames from that video.</p>
<p>Is there a jquery plugin or other type of tutorial that teaches this effect?</p>
| javascript jquery | [3, 5] |
5,050,391 | 5,050,392 | Firefox 5 inactive tab jQuery animation issue | <p>I have coded a slider to my project but it fails on chrome and firefox5.
Slider has a info bar and if page is in inactive tab, it queues the animation of infobar and when i return to the my page it repeats animation n times.</p>
<p>How can i fix that issue ? :(</p>
<p>I try: setTimeout but it couses a new bug that infobar never seems :S</p>
<p>The test link of my project is here : <a href="http://demo.cihanuygun.com/polo/" rel="nofollow">http://demo.cihanuygun.com/polo/</a></p>
| javascript jquery | [3, 5] |
942,609 | 942,610 | Dropdownlist data not insert in query | <p>I select the <code>DropDownList</code> value to insert in query but the value remains blank in query and due to empty value in where condition not any result outcome. I do with different tricks but remain empty</p>
<pre><code>if (chkBoxChanl.Checked)
{
sql += " and channelName = '" + ddlChannel.Text + "' ";
}
if (chkBoxDate.Checked)
{
sql += " and transmissionDate_ between '" + tbFrom.Text + "' and '" + tbTo.Text + "'";
}
if (chkBoxProgrm.Checked)
{
sql += " and programName ='" + ddlProgram.Text + "'";
}
if (chkBoxParty.Checked)
{
sql += " and partiesName like '%" + ddlParty.SelectedValue + "%'";
}
if (chkBoxPerson.Checked)
{
sql += " and personsName like '%" + ddlPerson.SelectedItem + "%'";
}
if (chkBoxProvince.Checked)
{
sql += " and ProvinceName like '%" + ddlProvince.SelectedItem + "%'";
}
if (chkBoxCity.Checked)
{
sql += " and CityName like '%" + ddlCity.Text + "%'";
}
</code></pre>
<p>Like</p>
<ul>
<li><code>ddlProgram.Text</code></li>
<li><code>ddlProvince.SelectedItem</code></li>
<li><code>ddlPerson.SelectedValue</code>
selected <code>DropDownList</code> value is shown empty in query.</li>
</ul>
<p>What can I do to add the selected value in query? Please help me!</p>
<p>I check that when I select the dropdownist values which come on first load then 2md time after press search button dropdownlist values empty and when I press search button it first run Page_Load function and if(!IspostBack) is execute then all dropdownlist selected values become empty which cause to empty values in where clause. Now I want that when I press search button dropdownlist values remain loaded which will resolve the issue to become enpty dropdownlist values. Please guide me further </p>
| c# asp.net | [0, 9] |
4,299,935 | 4,299,936 | Which is faster? | <p>Which of these is more efficient in terms of speed (number of lines of code generated).</p>
<pre><code>var x=obj.mem;
x.do1();
x.do2();
</code></pre>
<p>or</p>
<pre><code>obj.mem.do1();
obj.mem.do2();
</code></pre>
<p>I just wrote those in a generic pattern. Specifically, if I have to access a member( or a member of a member ) , is it better to assign the common part to a variable and then use that variable or to call it directly as shown in the second case. </p>
<p>I'm concerned mainly about C++ and JavaScript (if it matters).
Thank You.</p>
<p>EDIT->
PS.I did not ask a common answer. I understand that Javascript is an interpreter language while C++ is compiler based. The little knowledge I have of JavaScript is self taught and we learned C++ for 2 years at school (and that too Turbo C++) and the rest is again self taught. So, forgive me for the confusion. I was expecting a general result assuming that the constructs are valid and considering any possible variations. Anyway, my major doubts were cleared. Thanks.</p>
<p>Conclusion: JS is faster with local variables (though negligible) and C++ will probably optimise to get almost equal results.</p>
<p>Thank You for all the input.</p>
| javascript c++ | [3, 6] |
707,935 | 707,936 | generating function arguments in java | <p>I'm very new to java and am working on my first Android app. I am using the webview demo as a template. I am trying to generate a random integer between 1 and 12 and then call a certain javascript function based on the result. Here's what I have:</p>
<pre><code>int number = 1 + (int)(Math.random() * ((12 - 1) + 1));
number = (int) Math.floor(number);
String nextQuote = "javascript:wave" + number + "()";
mWebView.loadUrl(nextQuote);
</code></pre>
<p>So <code>mWebView.loadUrl(nextQuote)</code> will be the same as something like <code>mWebView.loadUrl("javascript:wave1()")</code></p>
<p>I just want to know if what I have here is correct and will work the way I think it will. The application isn't responding as expected and I suspect this bit of code is the culprit. </p>
| java android | [1, 4] |
1,827,706 | 1,827,707 | C#: How do i convert a const override from C++ to C# | <p>The line of code i need to translate from C++ to C#:</p>
<pre><code>void GetAnalysisModeName( ON_wString& name ) const;
</code></pre>
<p>I've tried with:</p>
<pre><code>public override void GetAnalysisModeName(string name){}
</code></pre>
<p>But it tells me that the return type has to be a string.</p>
| c# c++ | [0, 6] |
2,606,670 | 2,606,671 | jQuery combobox plugin | <p>I am looking for jQuery plugin that does something very similar to <a href="http://translate.google.com/" rel="nofollow">google translate</a> when you click on 'detect language'. I couldn't find this in jQuery UI - is there anything out there?</p>
| javascript jquery | [3, 5] |
2,138,756 | 2,138,757 | Android best practices | <p>I was wondering if there are any lists of best practices for Android/Java. I know there are in .Net like using String.Concat instead of blah & blah.</p>
<p>Are there any that you have found, others might not know about?</p>
| java android | [1, 4] |
2,414,310 | 2,414,311 | On click of asp.net button the page is coming to its page_load state | <p>On click of the asp.net Button, the page is coming to its original state as the page_load.I'm writing the click functionality of the button inside the jQuery's $('document').ready() event.Any help will be highly appreciated.</p>
| jquery asp.net | [5, 9] |
3,267,643 | 3,267,644 | Is is safe to pass an Android Button object outside of an OnClick() handler? | <p>OK I really need to know if I can pass the button out to a method like this or not. Am I going about this right? I am a major Java newbie same with the TextView as well I guess I would assume they would act the same, I have tried searching but can't seem to find anything. Eclipse isn't throwing any wobblies and the app runs fine until I press a button then it crashes with a resource exception. Thanks in adavance :)</p>
<pre><code>b1.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
gameTurnLogic(player, 0, b1, myTv);
}
});
</code></pre>
<p>}</p>
<pre><code>public void gameTurnLogic(boolean p, int buttonNumb, Button button, TextView textview){
if(player == true && board[buttonNumb] == 0){
board[buttonNumb] = 1;
player = false;
btnText(button, 'O');
textview.setText("Player 2's Turn");
checkWin(textview);
}
else if(player == false && board[buttonNumb] == 0){
board[buttonNumb] = 2;
player = true;
btnText(button, 'X');
textview.setText("Player 1's Turn");
checkWin(textview);
}
else if(player == true && board[buttonNumb] != 0){
textview.setText("location already used!");
}
else if(player == false && board[buttonNumb] != 0){
textview.setText("location already used!");
}
}
</code></pre>
| java android | [1, 4] |
2,076,422 | 2,076,423 | Check if jQuery method exists | <p>Is it possible? No matter how, in Javascript or jQuery.</p>
<p>For example: <code>$.isFunction($.isFunction());</code></p>
<p>Upd: But how to check method of a jQuery plugin? Sometimes it not ready at the moment of it call and generates error. Example: <code>$.isFunction($().jqGrid.format)</code></p>
| javascript jquery | [3, 5] |
1,303,771 | 1,303,772 | How should I generate HTML to represent class and its properties? | <p>Currently I have a class that represents a document. This document needs to be displayed as HTML. I would like to have a method to call such as <code>GetHTML()</code> that would then call <code>GetHTML()</code> on any properties/sections of the document that needed to be rendered. I was initially thinking about using linq and <code>XElement</code> but am wondering if that may cause issues with certain tags in HTML. Would I better off using an <code>HtmlTextWriter</code>? I am open to any suggestions or best practives for this situation. Thanks!</p>
| c# asp.net | [0, 9] |
2,369,298 | 2,369,299 | How can I pass function arguments to jquery .animate? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/13236473/using-a-dynamic-variable-as-object-literal-jquery-animate-function">Using a dynamic variable as object literal, jQuery animate function</a> </p>
</blockquote>
<p>I'm attempting to pass a function argument as a setting for a jquery animation except I cannot get it working. </p>
<p>The Function</p>
<pre><code>function gridClick(a, b){
$(c).animate({
a : 0,
b : 0
}, 10000)
};
</code></pre>
<p>calling the function </p>
<pre><code>gridClick('top', 'left', this);
</code></pre>
<p>console log shows that a and b are being put out as top and left but they are not actually affecting the animation as top and left. Is this a syntax error or is there more going on?</p>
| javascript jquery | [3, 5] |
1,049,304 | 1,049,305 | Best way to know which device type is requesting website? | <p>What is the best way to know which device type is requesting website?</p>
<p>I want to know that which device (desktop/laptop/mobile/tablet etc..) is generating request to my website using java script/j-query or c# code.</p>
<p>Also i want to know few more details:</p>
<p>Device screen resolution
OS Name
Browser Name and Version
Requesting IP address
Device ID
Location</p>
<p>Is there any way to get all the above details...pls suggest.</p>
| c# javascript jquery | [0, 3, 5] |
3,315,721 | 3,315,722 | Android TextView | <p>Hi I'm new to Android Programming and I'm trying to make a simple program that changes the text by clicking a button. Here's my code:</p>
<pre><code>public class HelloAndroidActivity extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button button_scan = (Button) findViewById(R.id.button_scan);
button_scan.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
buttonBeenPressed();
}
});
}
public void buttonBeenPressed(){
final Button button_scan = (Button) findViewById(R.id.button_scan);
TextView tv_barcode = (TextView)findViewById(R.id.textview_barcode);
if (tv_barcode != null){
tv_barcode.setText("been pressed.");
} else {
button_scan.setText("it's null dawg.");
}
}
}
</code></pre>
<p>And my XML:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<Button android:text="Scan" android:layout_height="wrap_content" android:layout_width="match_parent" android:id="@+id/button_scan"></Button>
<TextView android:layout_height="wrap_content" android:layout_width="wrap_content" android:text="TextView" android:textAppearance="?android:attr/textAppearanceLarge" android:id="@+id/textview_barcode"></TextView>
</LinearLayout>
</code></pre>
<p>However the TextView is returning NULL and i don't know why. Any suggestions? Thanks.</p>
| java android | [1, 4] |
4,276,648 | 4,276,649 | Set Select Dropdown with jQuery | <p>The question has been asked multiple times, but this is not a repeat. I am using a for loop to search through a div of elements including select, input etc. It matches the class name to an objects parameter and if it matches it sets the value of the element.</p>
<pre><code>for(var i in obj) {
if(obj.hasOwnProperty(i)) {
$(editClone).find('.' +i).val(obj[i]);
}
}
</code></pre>
<p>It works fine on input elements, but with the select element it removes all the options and simply sets the value on the actual element tag.</p>
<p>This is the select statement before I run my javascript:</p>
<pre><code><select class="type">
<option value="Home">Home</option>
<option value="Work">Work</option>
<option value="Mobile">Mobile</option>
<option value="Other">Other</option>
</select>
</code></pre>
<p>And after I run the code (inspected in firebug to verify):</p>
<pre><code><select class="type">Mobile</select>
</code></pre>
<p>Why does it do this? I thought val() was supposed to set a matching option tag to selected. The object value and option tags are matching, but it does not do what it is supposed to. What am I doing wrong here?</p>
<p><strong>Turns out I had the DIV I was trying to clone nested in the wrong place in the HTML as well as a bad clone call in the javascript. Totally unrelated errors. The answer below is correct, it just didn't work in my situation because I didn't understand the problem I was having.</strong></p>
| javascript jquery | [3, 5] |
5,262,174 | 5,262,175 | Android. How to start activity without creating new one? | <p>I tried to set attribute <code>android:launchMode="singleTask"</code> for calling Activity, but it still does not works as I expected.</p>
<p>I need that method <code>onCreate(Bundle bundle)</code> to be called only once, but it still calls each time when I start Activity.</p>
<p>I start Activity using code like this:</p>
<pre><code>public void onClick(View v) {
Intent myIntent = new Intent(v.getContext(), NextActivity.class);
startActivity(myIntent);
}
</code></pre>
<p>Please let me know what I am doing wrong</p>
| java android | [1, 4] |
3,915,288 | 3,915,289 | Calling Java code from c++ in an Android application | <p>I'm currently attempting to call some Java code from C++ in an Android application using JNI. However, I cannot get anything to compile when I attempt to create a java virtual machine using the "JNI_CreateJavaVM" method. It comes up with the error: "undefined reference to `JNI_CreateJavaVM'"</p>
<p>It's clearly declared in the jni.h header file, and I am able to make use of type and struct definitions that are made in the header file without error, so the code is definitely including it. It's just unable to compile when I attempt to make use of JNI_CreateJavaVM. Is there something else that needs to be included along with it, or is there some other method of getting a virtual machine to make calls to Java from C++?</p>
<p>Here is the code I'm attempting to build it with:</p>
<pre><code>#include "HelloWorldScene.h"
#include <stdio.h>
#include <jni.h>
#include <string.h>
bool HelloWorld::init()
{
JavaVM* jvm;
JNIEnv* env;
JavaVMInitArgs args;
jint result = JNI_CreateJavaVM(&jvm, &env, (void*)&args);//The code compiles if this line is commented out.
//...Various initialization procedures
return true;
}
</code></pre>
| java android c++ | [1, 4, 6] |
296,013 | 296,014 | Adding screen brightness controls to android application | <p>I am looking to add controls to adjust screen brightness locally in my app menu but can't seem to figure out how to do it. I have seen examples to max-out or dim brightness but I am looking to add controls so that the user can control and set the brightness level. Does anyone have any examples, tutorials, source code, or just a place to point me in the right direction?</p>
| java android | [1, 4] |
5,545,897 | 5,545,898 | Javascript - Uncaught SyntaxError: Unexpected token <? | <p>Javascript: </p>
<pre><code>jQuery(document).ready(function() {
jQuery('#submit').click(function() {
jQuery("#LoadingImage").show();
var imgSrc = 'http://foo.com/gen.php?username1=' + jQuery('input[name=username1]').val() + '&amp;username2='+ jQuery('input[name=username2]').val();
jQuery('#imgRESULT').html('<img id="image1" src="' + imgSrc + '" >');
});
$('#image1').on("load", (function() {
$("#LoadingImage").hide();
});
});
</code></pre>
<p>With the html being</p>
<pre><code><div id="LoadingImage" style="display: none">
<img src.... /></div><div align="center" id="imgRESULT"></div>
</code></pre>
<p>and with the correct inputs etc.</p>
<p>But going into the console I get:</p>
<p><img src="http://i.stack.imgur.com/57vFu.png" alt="error"></p>
<p>(Uncaught SyntaxError: Unexpected token <)</p>
<p>I can't seem to see how to get this script working.
Any input?</p>
| javascript jquery | [3, 5] |
1,733,133 | 1,733,134 | jQuery hasClass check on altered DOM | <p>I'm having trouble with the jQuery function 'hasClass'. It returns false while it should return true. The hasClass function is looking for an class which was added by javascript. So maybe the hasClass function can't find classes in altered HTML? If so, how can I fix it the best way?</p>
<pre><code>$(".slides").mouseover(function(){
$(this).stop(true, true).animate({"width": "+=30px", "height": "+=30px", "margin-top": "+=15px"}, 200);
})
$(".slides").mouseout(function(){
alert($(this).hasClass('activeSlide'));
if(!$(this).hasClass('activeSlide')){
$(this).stop(true, true).animate({"width": "-=30px", "height": "-=30px", "margin-top": "-=15px"}, 200);
}
});
$("body").click(function(){
$(".activeSlide").removeClass("activeSlide");
});
$(".slides").click(function(){
$(".activeSlide").removeClass("activeSlide");
$(this).addClass("activeSlide");
alert("Set");
});
</code></pre>
| javascript jquery | [3, 5] |
5,724,862 | 5,724,863 | JS behavior differs depending on page tree | <p>I'm a developer for a very large real estate plugin and I'm having a lot of trouble with one of our agent sites:</p>
<p>The init methods used to initialize ajax functionality are called using a <code>jQuery(document).ready()</code> handler. However, this doesn't always fire, and it seems to be less dependent on the page contents than the location in the sitemap.</p>
<p>The theme script also uses the same jQuery ready script to run methods, and that works on all pages. This file is included in the header. My file is included in the footer, that jQuery ready script does not load on certain pages.</p>
<p>The site is <a href="http://mportlandrealestate.com/" rel="nofollow">http://mportlandrealestate.com/</a>. The scripts seem to load on every page but those underneath the Areas and Neighborhoods top level page. Also, Areas and Neighborhoods -> Inner NE and its subpages DO work, but all others do not. If I move a page from the Inner SE tree to be a child of Inner NE it begins to work, with no content changes.</p>
<p>You can tell the scripts are loading through some console.group statements output in the javascript console: lightbox::init, clipboards::init, and ajax::init should all be present if the footer scripts are initializing.</p>
<p>Any ideas? This is baffling me.</p>
| jquery javascript | [5, 3] |
3,758,576 | 3,758,577 | Java Script / jQuery, how to go do different pages and trigger clicks at different interval times? | <p>i have 3 pages with 3 buttons:</p>
<p>index1.php <code><input type="submit" value="button1" id="submit_btn"/></code></p>
<p>index2.php <code><input type="submit" value="button2" id="submit_btn"/></code></p>
<p>index3.php <code><input type="submit" value="button3" id="submit_btn"/></code></p>
<p>what i want is to create a script that goes to <code>index1</code> and clicks on the <code>button1</code> then waits 10 min and goes to <code>index2.php</code> and clicks to <code>button2</code>.</p>
<p>i could use <code>$('#button1').click();</code> and the <code>setTimeout(function(){..}</code> function, but how do i handle errors like if the page is not loaded, or if there is a server error and the page needs to be refreshed...</p>
<p>thanks</p>
| javascript jquery | [3, 5] |
4,929,125 | 4,929,126 | Is there a way to capture the changes to a textarea? | <p>Here is what I am working with right now</p>
<pre><code>$("#text").on("input", function(event){
console.log("The changes are:" + SomeDataThatIDontKnowHowToAccess);
});
</code></pre>
<p>I realize that this could potentially break for the backspace/pasting over text/insert/delete. I don't really know how this could be handled, maybe have delete/insert/override events... I'd rather not roll my own solution.</p>
<p><strong>An Example</strong></p>
<p>The user pastes <code>something</code> in a blank textarea</p>
<p><code>{eventType:'insert', value:'something'}</code> </p>
<p>shows up in the console</p>
| javascript jquery | [3, 5] |
1,368,986 | 1,368,987 | How do I do a jQuery load without a query string and arguments? | <p>I have a dumb network device that has limited HTTP hosting capabilities and I'm trying to write a slightly more dynamic page to display data with. A some current process values can be found in plain-text at <code>/temp.dat</code> on the device, but my stone-simple jQuery script...</p>
<pre><code>$(document).ready(function() {
$('#temp').load('/temp.dat');
var refreshId = setInterval(function() {
$('#temp').load('/temp.dat');
}, 2000);
$.ajaxSetup({ cache: false });
});
</code></pre>
<p>...seems to endlessly fail (only after the first <code>.load</code> on the initial page load) because the device abhors HTML query parameters. Chrome's JS console shows endless errors like the following:</p>
<pre><code>GET http://192.168.1.250/temp.dat?_=1341980712854
</code></pre>
<p>How can I get jQuery (or pure JavaScript) to hammer away at a specific URL without attaching the HTML query (...<code>?_=123456789</code>)?</p>
| javascript jquery | [3, 5] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.