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 |
---|---|---|---|---|---|
2,054,425 | 2,054,426 | Jquery Hide Function in PHP | <p>I have a while statement that is echoing about 10 different stories. Every story has a user comment. When clicking the button edit I want one of the functions to hide the user comment. Here is the code I wrote to try and make it happen. Let me know if you think of why this wouldn't work.</p>
<pre><code><script>
$(".edit_<?php echo $story_id ?>").click(function () {
$(".comment_<?php echo $story_id ?>").hide("fast");
});
</script>
<?php
if (!empty($user_comment))
echo "
<p class='user_comment comment_$story_id'><strong>$user_comment</strong> <a class='edit_story_comment edit_$story_id'>Edit</a></p>";
else
echo "<p id='user_comment_$story_id'><span id='edit_no_story_comment'>Edit</span></p>";
?>
</code></pre>
| php jquery | [2, 5] |
63,095 | 63,096 | I'm unable to get the date to equal my string in my Jquery Datepicker | <pre><code>var currDay = date.getDate();
var currMonth = date.getMonth();
var currYear = date.getFullYear();
var fullDate = currMonth + '/' + currDay + '/' + currYear;
fullDate = fullDate.toString();
if(fullDate == special_dates[b][4]){
return[false];
}
</code></pre>
<p>I'm using the jquery ui datepicker. special_dates is my array with the date as a string like 12/30/2010</p>
<p>fullDate and special_dates are working when I alert it, so I'm not sure what im doing wrong. </p>
| javascript jquery | [3, 5] |
5,923,011 | 5,923,012 | Problem with char * in python | <p>I've just wrapped a header (.h) file and created .so to use it as a module in python. The function Encrypt takes char* bb, then fill it using memcpy(). If I want to call this function from a c code I have to do (char* bb = (char*) new char[200]; Encrypt (...,...,..., bb);). How to call it from python? How is the equivalent of (char* bb = (char*) new char[200];) in python?</p>
<pre><code>int Encrypt (string key, string iv, string plaintext, char* bb)
{
std::string ciphertext;
CryptoPP::AES::Encryption aesEncryption((byte *)key.c_str(), CryptoPP::AES::DEFAULT_KEYLENGTH);
CryptoPP::CBC_Mode_ExternalCipher::Encryption cbcEncryption( aesEncryption, (byte *)iv.c_str() );
CryptoPP::StreamTransformationFilter stfEncryptor(cbcEncryption, new CryptoPP::StringSink( ciphertext ) );
stfEncryptor.Put( reinterpret_cast<const unsigned char*>( plaintext.c_str() ), plaintext.length() );
stfEncryptor.MessageEnd();
memcpy(bb,ciphertext.c_str(), ciphertext.size());
return ciphertext.size();
};
</code></pre>
<p>Calling Encrypt() from c:</p>
<pre><code>char* bbb = (char*) new char [400];
int sizec = Encrypt(key, iv, plaintext, bbb);
</code></pre>
<p>I used create_string_buffer("", 400) in python but it does not work.</p>
| c++ python | [6, 7] |
5,570,267 | 5,570,268 | Value is undefined when element is obtained with jQuery | <p>Below is the code where I obtain my input element with jQuery:</p>
<pre><code>var txt = $(tableRow).find('input:text');
if (txt.value == null) {
//TO DO code
}
</code></pre>
<p>and here's how I do it </p>
<pre><code>var txt = document.getElementById('txtAge');
if (txt.value == null) {
//TO DO code
}
</code></pre>
<p>With the first way the value of the txt is undefined. But with the second way the value is what's inside the input element. Now more interesting is, on the bottom-right pane of the Mozilla Firebug if I scroll down to the "value" of the txt I can see it there, both ways. </p>
<p>I know I can simply say <code>$(txt).val()</code>, but I also want to understand why I can't access the value of an element if it's been selected by jQuery. Isn't jQuery just a library of JavaScript functions?</p>
| javascript jquery | [3, 5] |
2,007,055 | 2,007,056 | jQuery: stop a <select> list from moving on keypress? | <p>I have HTML/jQuery like this:</p>
<pre><code><select id="userlist" name="userlist">
<option value=''></option>
<option value="ADJUDICATION">ADJUDICATION</option>
<option value="ADMINISTRATIVE">ADMINISTRATIVE LAW</option> # etc
</select>
$("#userlist").keypress(function(e) {
windows_id += String.fromCharCode(e.which).toUpperCase();
// Only do anything if we have more than 1 initial.
if (windows_id.length > 1) {
// do stuff here
}
});
</code></pre>
<p>As you can see, if the user types more than two characters in, I want to do something special. </p>
<p>My question is this: is there any way I can prevent the <code><select></code> list from moving after the user has typed just one character, and instead, hold it still until the user has typed two?</p>
<p>Thanks!</p>
| javascript jquery | [3, 5] |
3,629,464 | 3,629,465 | InnerText in Python | <p>Is there an equivalent to the c# <a href="http://msdn.microsoft.com/en-us/library/system.xml.xmlnode.innertext.aspx" rel="nofollow"><code>XmlNode.InnerText</code></a> Property in Python?</p>
<p>If not, is there a straightforward way to implement it in Python? I thought I found something <a href="http://www.chaingang.org/bcc/2011/09/12/inner-text/" rel="nofollow">here</a>, but it seems to concatenate the values of the node and child nodes in the wrong order.</p>
| c# python | [0, 7] |
5,379,672 | 5,379,673 | Two methods with different signatures, jquery is not calling correct method | <p>There are two methods <code>GetUserAssignedSystems()</code> and <code>GetUserAssignedSystems(string Id)</code>
These methods act very differently from each other. The problem is, when I want to call <code>GetUserAssignedSystems(string Id)</code>, the parameter-less method is called.</p>
<p>Here are the methods:</p>
<pre><code>[WebMethod]
[ScriptMethod]
public IEnumerable GetUserAssignedSystems(string cacId)
{
return Data.UserManager.GetUserAssingedSystems(cacId);
}
[WebMethod]
[ScriptMethod]
public IEnumerable GetUserAssignedSystems()
{
//do something else
}
</code></pre>
<p>Here is the jQuery making the call:</p>
<pre><code>CallMfttService("ServiceLayer/UserManager.asmx/GetUserAssignedSystems",
"{'cacId':'" + $('#EditUserCacId').val() + "'}", function(result) {
for (var userSystem in result.d) {
$('input[UserSystemID=' + result.d[userSystem] + ']').attr(
'checked', 'true');
}
});
</code></pre>
<p>Any ideas why this method is being ignored?</p>
<p><strong>UPDATE</strong></p>
<p>Here is the code for the CallMfttService</p>
<pre><code>function CallMfttService(method, jsonParameters, successCallback, errorCallback){
if (errorCallback == undefined)
{
errorCallback = function(xhr)
{
if (xhr.status == 501)
{
alert(xhr.statusText);
}
else
{
alert("Unexpected Error");
}
}
}
$.ajax({
type: "POST",
url: method,
data: jsonParameters,
contentType: "application/json; charset=utf-8",
dataType: "json",
success: successCallback,
error: errorCallback
});
</code></pre>
<p>}</p>
| c# jquery | [0, 5] |
1,407,071 | 1,407,072 | How to get index of current records in C# ASP.NET ListView in Render Time | <p>I have a list view like below:</p>
<pre><code><asp:ListView ID="lstTopRanks" runat="server">
<ItemTemplate>
<div class="Amazing-{recordNumber}">{itemdata}</div>
</ItemTemplate>
</asp:ListView>
</code></pre>
<p>I would like to replace <code>{recordNumber}</code> with a running counter so the first record shown have 1 the second will be 2 and so on.</p>
<p>How can I do this?</p>
<p>Thanks in advance</p>
| c# asp.net | [0, 9] |
1,183,211 | 1,183,212 | Periodically autosave form | <p>How to implement a periodical save of a form in the background? Same kinda thing that gmail does. </p>
| javascript jquery | [3, 5] |
4,352,481 | 4,352,482 | Jquery passing variable problem | <pre><code> for(var n=0;n<10;n++)
{
$('#content-scroll'+n).mousewheel(function(event, delta) {
if (delta > 0) sliderUp(n-1);
else if (delta < 0) sliderDown(n-1);
return false; // prevent default
});
n++;
}
</code></pre>
<p>I have a problem with this code, variable "n" is not passed right to the mouswheel function which will add mousewheel only to number 9 (last number) and not to all 10 elements.
Can anyone explain how to pass a variable to this function so that it stays?</p>
| javascript jquery | [3, 5] |
5,220,510 | 5,220,511 | Two ways to make python based webpages? | <p>I wanted to try out python to create webpages instead of using php. However I came across that you need either mod_python or mod_wsgi installed to apache to make it play with python. If you now use pure, i'm not sure if it should be said pure, python code, not using any web frameworks like django. I found out that making a simple page looks differently in mod_python and in mod_wsgi.</p>
<p>How come?, the more I looked into python it just seemed to be a harder language to use to make webpages comparing it to php. Is there some good starting point to learn python webdevelopment?</p>
<p>Sorry if my question is blurry. I simply want some guidance to start out with python webdevelopment</p>
| php python | [2, 7] |
1,848,624 | 1,848,625 | How to call a php function from Javascript | <blockquote>
<p><strong>Possible Duplicates:</strong><br>
<a href="http://stackoverflow.com/questions/3761448/how-to-call-php-function-in-js">how to call php function in JS?</a><br>
<a href="http://stackoverflow.com/questions/221396/javascript-and-php-functions">Javascript and PHP functions</a> </p>
</blockquote>
<p>Hi,</p>
<p>I would like to invoke different php function with client window resolution.Consider
if the users browser is large enough, then I would like to show a message from php function as vertical and if the browser is less than 960px wide then and only I would like to show the message as horizontal component.Any suggestions please...
Thanks</p>
| php javascript | [2, 3] |
4,963,262 | 4,963,263 | jQuery .attr('value', 'new_value') not working? | <p>I am trying to dynamically change the actual HTML <code>value</code> attribute of an input using jQuery. Although using <code>input.attr('value', 'myNewVal');</code> works to change it visually, when I inspect the source using Developer Tools in Chrome, the HTML attribute hasn't changed.</p>
<p>Since I'm doing a check in some PHP later on to see if the input has its original value, I need a way of changing the actual HTML attribute, ideally in jQuery. Has anyone else encountered this annoying bug and do any of you guys know a workaround?</p>
<p>I've also tried with <code>.val()</code> and the same happens - the underlying HTML attribute is unchanged.</p>
| javascript jquery | [3, 5] |
988,786 | 988,787 | jquery, Showing a hidden item with a fadeIn | <p>in jquery, how can I show a hidden div, and make it fade in?</p>
| javascript jquery | [3, 5] |
5,125,750 | 5,125,751 | OnNewIntent does not show Toast | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/11304267/displaying-a-toast-notification-in-android-framework">Displaying a Toast notification in Android framework</a> </p>
</blockquote>
<p>I have an activity and in onResume there is the following Code:</p>
<pre><code>super.onResume();
Intent intent = new Intent(this, this.getClass());
intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, 0);
nfcAdapter.enableForegroundDispatch(this, pendingIntent, null,null);
</code></pre>
<p>In the onNewIntent(Intent intent) function I have:</p>
<pre><code>super.onNewIntent(intent);
setIntent(intent)
..
...
Toast.makeText....
</code></pre>
<p>But the Toast does not show up - does someone have a solution for this problem?</p>
| java android | [1, 4] |
4,905,614 | 4,905,615 | How to send data into URL via POST - ASP.Net | <p>Below is the form in HTML that I want to send. But the problem is that since some input fields change their input value dynamically, I can't use an HTML form. So I need an asp.net form: these input field vales need to be set via code-behind.</p>
<p>Please help, how should I implement this in C# asp.net?</p>
<pre><code><form method="post" action=https://xxx.com id="form1" name="form1">
<input type="hidden" name="meID" value="0050xxxxx">
<input type="hidden" name="subID" value="0">
<input type="hidden" name="amount" value="100" >
<input type="hidden" name="pID" value="0511181">
<input type="hidden" name="language" value="nl">
<input type="hidden" name="currency" value="EUR">
<input type="hidden" name="description" value="Product">
<input type="hidden" name="itemNumber1" value="Incasso">
<input type="hidden" name="itemDescription1" value="Incasso payment">
<input type="hidden" name="itemQuantity1" value="1">
<input type="hidden" name="itemPrice1" value="25000">
<input type="hidden" name="paymentType" value="ideal">
<input type="hidden" name="validUntil" value="2012-01-28T12:00:00:000Z">
<input type="hidden" name="urlCancel" value="https://xxx.com">
<input type="hidden" name="urlSuccess" value="https://xxx.com">
<input type="hidden" name="urlError" value="https://xxx.com">
<input type="submit" name="submit2" value="Verstuur" id="submit2">
</form>
</code></pre>
| c# asp.net | [0, 9] |
925,077 | 925,078 | URL breaking when it contains # in jQuery ajax request | <p>When I request a url with jquery Ajax that contains # sign, the string of the url after # gets cut off. For example:</p>
<pre><code>http://somesitem.com/?name=Some#thing
</code></pre>
<p>When I observe this url being requested in firebug, I see that all that is being submitted is:</p>
<pre><code>http://somesitem.com/?name=Some
</code></pre>
<p>I tried to use encodeURI function with no success. </p>
<p>Any tips on how to submit the entire string containing the #?</p>
| javascript jquery | [3, 5] |
2,418,855 | 2,418,856 | Can some one tell how can I register the jquery function on button click which is in master page | <p>Hi all I am having a master page where I am having a button, where I have written some script as follows</p>
<pre><code><script type="text/javascript">
$(document).ready(function () {
$("#btnMaster").click(f2());
});
function f2() {
if (isDirty == 1) {
jConfirm('Can you confirm this?', 'Confirmation Dialog', function (r) {
if (r == true) {
document.location.href = "http://localhost:2758/Waitingweb/Status.aspx";
}
else
return false;
});
//return false;
return false;
}
else {
}
}
</script>
</code></pre>
<p>In my master page load I write as follows</p>
<pre><code>if (!IsPostBack)
{
//Page.ClientScript.RegisterStartupScript(Page.GetType(), "PostbackClick", "$('#btnMaster').click();", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "click", "f2();", true);
Page.ClientScript.RegisterStartupScript(this.GetType(), "myScript", "<script type=\"text/JavaScript\" language=\"javascript\">f2();</script>");
}
</code></pre>
<p>But I am unable to fire the required when handling the button from content page, so can some one help me regarding this</p>
| jquery asp.net | [5, 9] |
2,927,532 | 2,927,533 | Splitting code in to multiple files for easier management | <p>I am currently using jQuery to write an online application, that started off with a couple of lines of code, and have quickly now become over a 1000 lines.</p>
<p>My code's structure is simple. I have a window.load which wraps my javascript, and inside it I start adding my click event handlers, and the various functions that makeup my application.</p>
<pre><code>$(window).load(function(){
// Code goes here...
});
</code></pre>
<p>My code functions can definitely be grouped into categories; e.g. 5 functions perform animation, 12 are event handlers, etc.</p>
<p>I would like to group the functions in their own js files, and import them individually. I can later use my CMS engine to concatenate and compress the files on the fly.</p>
<p>What is the best way in doing so. I am thinking that maybe I can give some of my functions their own namespace for further clarity; e.g. all animation functions are prefixed with ANIMATION - ANIMATION.moveDiv1(), ANIMATION.moveDiv2, MYEVENT.div1Clicked, etc.</p>
| javascript jquery | [3, 5] |
2,337,698 | 2,337,699 | asp.net selectedvalue bind conditionally | <p>I like to do a conditional bind. For example if the SelectedValue is null,
I like to bind it to "Pacific Time".
Below does not work but will give you an idea of what I am trying to do</p>
<pre><code> SelectedValue='<%# Bind("Zone") ?? "Pacific Time" %>'
</code></pre>
| c# asp.net | [0, 9] |
206,084 | 206,085 | address parsing and validation technique required for Australia zone with regex | <p>We need to implement the validation for the following field</p>
<p><strong>Street Address/ Business Address</strong></p>
<p>Conditions which needs to be taken care are as below</p>
<p>Post office box, private bag NOT acceptable as address. The address field should not start with the following:</p>
<p><strong>NOTE:</strong> <em><strong>^ = space</em></strong></p>
<pre><code>G^P^O
GPO^
G.P.O
GPO.
G.P.O. Box
P^O
P.O
PO^
PO.
P.O.
P.O.B
POBOX
POST BOX
POST OFFICE BOX
P / O Box
P/O Box
P O Box
P.O. Box
BOX^
BOX.
Private Bag^
Private Bag.
Locked Bag
</code></pre>
<p>This list needs to be configurable to allow for additional rules to be included at a later date. There is no need to validate for upper/lower case</p>
<p>Can you suggest me this kind of validation can be better implement using Javascript or Java?</p>
<ol>
<li><p>if I use Java, is it advisable to use Regex class</p></li>
<li><p>If Javascript, what should be my way </p></li>
</ol>
<p>Kindly share your sample code if you have any</p>
<p>I am checking if we use of Regex would be helpful in doing this?</p>
<p>ps: Since this project cant use any google or yahoo api or any other paid APIs to parse the street address.</p>
| java php javascript | [1, 2, 3] |
416,254 | 416,255 | jQuery Animate backgroundColor with If and Else | <p>I'm trying to use <code>if</code> and <code>else</code> in a jQuery Function based in the <code>backgroundColor</code> of a <code>li</code> tag, for exemple: If this <code>backgroundColor = #ccc</code> do something, else, do other. I tried like this:</p>
<pre><code>if ($(this).css('backgroundColor = #EBE5C5')) {
</code></pre>
<p>but it doesnt work right, can you help me?</p>
<p>Hmm,thanks a lot, but it still not working right, see the full function right here:</p>
<pre><code>$(function(){
$('.slider-nav li')
.mouseover(function(){
if ($(this).css('background-color') == "#EBE5C5") {
$(this).stop().animate({'backgroundColor':'#c0ba9f'},250);
}
})
.mouseout(function(){
$(this).stop().animate({'backgroundColor':'#EBE5C5'},250);
})
});
</code></pre>
| javascript jquery | [3, 5] |
4,078,519 | 4,078,520 | how to send element values from parent window to child layer window element? | <p>i have an array of comments from DB and each comment have a reply links. when i click on the anchor reply i need to open a new layer window.. and i need that particular comment id in the newly popup layer window.</p>
| php javascript jquery | [2, 3, 5] |
3,976,088 | 3,976,089 | How to write a table content to an xml? | <p>Can somebody tell me how can i write a clientside table control content to an xml on a button click . I'm using a clientside table "selectedTexts" and on save button click i need to save the table content to an xml. Please help.</p>
<pre><code> $(document).ready(function() {
$('#<%=btnSave.ClientID %>').click(function(event) {
var xml = "<schedule>";
$("#selectedColumns").find("tr").each(function() {
xml += "<data>";
xml += $(this).find("td").eq(1).html() + "\n";
xml += "</data>";
});
xml += "</schedule>";
this.isPrototypeOf(
alert(xml);
})
});
</code></pre>
<p>I managed to get the string in an xml format. How can i pass this string to my codebehind so that i can write it to an xml file. Or is it any other methods available to write it from the clientside itself?</p>
| javascript jquery asp.net | [3, 5, 9] |
4,389,476 | 4,389,477 | How to make jQuery load() work for all elements of array, not just last one | <p>I have a web page that show a list of data feeds by name (the dataFeed variable below) and I am trying to simulate a pop-up window that contains more information about the data feed when the user clicks on the icon (dataFeed + 'dataLink') next to the data feed name. I have a hidden div (diagWindow) that contains a div (diagWindowContent) that is populated with this information about the feed. The getDiagData.php page returns this information that I want to display, using the dataFeed parameter passed to it.</p>
<p>At first I tried this...</p>
<pre><code>for (i = 0; i < dataFeeds.length; i++) {
dataFeed= dataFeeds[i];
$('#' + dataFeed+ 'diagLink').click(function() {
$('#diagWindow').toggle();
$('#diagWindowContent').load('getDiagData.php?dataFeed=' + dataFeed);
});
}
</code></pre>
<p>but that only displayed the page returned for the last dataFeed in the dataFeeds array.</p>
<p>Then I tried using a a callback method on the toggle(), like this...</p>
<pre><code>for (i = 0; i < dataFeeds.length; i++) {
dataFeed= dataFeeds[i];
$('#' + dataFeed+ 'diagLink').click(function() {
$('#diagWindow').toggle('fast', function(dataFeed) {
return function() {
$('#diagWindowContent').load('getDiagData.php?dataFeed=' + dataFeed);
}(dataFeed)
);
});
}
</code></pre>
<p>but that appeared to have the same result, displaying the information for the last data feed in the dataFeeds array.</p>
<p>I am seeking help on figuring out how to make the appropriate data feed information load from the getDiagData.php page when clicking on the icon next to the data feed name.</p>
<p>Thank you.</p>
| php javascript jquery | [2, 3, 5] |
947,886 | 947,887 | jquery star rating vertical | <p>I'm using the jquery star rating plugin by fyneworks. The problem is that about 5% of the time (and on the initial page load), the stars stack vertically instead of horizontally!?</p>
<p>When you refresh the page, they are fine - which is really odd. <a href="http://www.nacremedia.com/stars/stars.html" rel="nofollow">Please see the page here.</a></p>
<p>Any suggestions would be greatly appreciated!</p>
<p>Thanks</p>
<p>EDIT: <a href="http://jquery-star-rating-plugin.googlecode.com/svn/trunk/jquery.rating.js" rel="nofollow">The unpacked JS can be found here</a></p>
| javascript jquery | [3, 5] |
5,719,065 | 5,719,066 | What are the tell-tale signs in an interview that a developer is not competent? | <p>I'm specifically talking about interviewing for a position for a very experienced and competent C++/C#/Java systems developer, not a html, javascript web developer position. In my experience nervousness is often not a good indicator, because many good developers get very nervous under pressure, so what is a good indicator?</p>
<p><hr /></p>
<p>Hmmm... sorry, <a href="http://stackoverflow.com/questions/400646/how-to-weed-out-the-bad-programmers-from-the-competent-ones-in-the-interview-proc">this</a> didn't pop up when I went to ask this question. I've been told previously I'm not necessarily meant to delete it, but just post a link to the existing one. Please, if people think I should delete it, post a comment here to let me know, quite happy to, it seems <em>very</em> similar to the other one.</p>
<p>... or should I just close it?</p>
| c# java c++ | [0, 1, 6] |
3,791,517 | 3,791,518 | PHP work with JS Jquery | <p>How do i make PHP work with JS?
I mean more like, i want to check if the user is logged in or not,
and if he is then it will:
$("#message").fadeIn("slow"); ..</p>
<p>How should i do this?
I have an idea maybe have a file that checks it in php, and then it echo out 1 or 0.</p>
<p>And then a script that checks if its getting 1 then do the message fade in.. But im not as so experienced to script that in JS</p>
| php javascript jquery | [2, 3, 5] |
3,739,972 | 3,739,973 | Add function to object | <p>I have the following code</p>
<pre><code>var PROMO = PROMO || {};
PROMO.Base = (function () {
var _self = this;
var Init = function () {
WireEvents();
};
var WireEvents = function () {
//wire up events
};
} ());
</code></pre>
<p>In the same file I have the code to call the above function</p>
<p>I am trying to get to an end point where I can use the following code</p>
<pre><code> $(document).ready(function () {
PROMO.Base.Init();
});
</code></pre>
<p>this gives the error</p>
<pre><code>Cannot call method 'Init' of undefined
</code></pre>
<p>Now I know there are many ways to write javascript, but in this case I want to be able to call my functions, or least the Init method in the way shown above. </p>
| javascript jquery | [3, 5] |
3,406,764 | 3,406,765 | Is it possible to hide a web based game jQuery code from the user? | <p>I know some of you just feel it is as a completely wrong question but I have a few requirements of such kind that's why I am asking this question. I understand that javascript is downloaded by the browser on client side so it's very difficult to hide that.</p>
<p>So now i have a game code completely written in jquery and i want that the user is not able to see the complete code because:</p>
<ol>
<li><p>The owner of the games doesn't want to show the game code to the user.</p></li>
<li><p>If a clever user reads the code carefully then he/she might be able to solve the puzzle(it's a puzzle game).</p></li>
</ol>
<p>So, is it good enough to use google closure compiler or yui compressor to make the code unreadable & secure for the above requirements?</p>
<p>If you think that it's not possible to do this in the situation then please suggest me any other way of doing this. Do I need to completely rewrite the game code into a server side language then convert it to js using some tool?</p>
| javascript jquery | [3, 5] |
4,543,228 | 4,543,229 | jQuery validation field by range | <p>How can I validate field by range?</p>
<p>I use additional-methods, but i don't know how providing parametr with range to my validation method via HTML.</p>
<p>Something of a<br />
<code><input type="text" class="rangeField" rel="[10, 20]" /></code></p>
<p>It's nice, if i can make a difference between integer and decimal in validation.</p>
| javascript jquery | [3, 5] |
5,669,488 | 5,669,489 | set cursor position in textarea at end once user clicked on textarea | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/4715762/javascript-move-caret-to-last-character">Javascript: Move caret to last character</a> </p>
</blockquote>
<p>I am working on text area using jquery, to provide good UI validation.
Currently I stuck at -</p>
<p>Once user click in text area I want to set cursor position forcefully at end.
Please provide me some jquery solutions so resolve this ?</p>
<p>Thanks in advance
-Pravin</p>
| javascript jquery | [3, 5] |
1,006,137 | 1,006,138 | Detect if java is installed on the web server from php | <p>Is it possible to detect from a php script if java is installed on the server (if I can run an exec() command with java)?</p>
<p>Thanks,</p>
<p>Benjamin</p>
| java php | [1, 2] |
5,849,062 | 5,849,063 | Web site project login against seperate database | <p>Howdy,
I use the Visual Studio 2010 - and I'd like to create a ASP.NET Website - however I would like to check the login against a seperate database and not the .mdf file because I need a bit more flexibility and the access to the remaining items in my database.</p>
<p>Does anyone of you have a good solution how I could achieve that?</p>
<p>Edit: The database which I have is a SQL Server 2008 R2 database, if that matters.</p>
| c# asp.net | [0, 9] |
2,690,804 | 2,690,805 | I need some help importing an RSS feed from Wordpress | <p>I'm trying to import the last 5 posts from a Wordpress RSS feed and show them on my site.</p>
<p>I was using this, but it grabs the whole feed.</p>
<pre><code><asp:DataList ID="dataNews" runat="server" DataSourceID="xmlSource" >
<ItemTemplate>
<a href="<%# XPath("link") %>"><%# XPath("title") %></a>
</ItemTemplate>
</asp:DataList>
<asp:XmlDataSource ID="xmlSource" runat="server" DataFile="http://myblog.com/feed" XPath="rss/channel/item" EnableCaching="true" />
</code></pre>
<p>How can I accomplish this?</p>
| c# asp.net | [0, 9] |
5,093,247 | 5,093,248 | Creating ascx dynamically and adding controls to it | <p>I am a beginner in asp.net(C#) and stuck in an important point.</p>
<p>I have a dropdown list on my homepage which users select a category.
After selecting the category, user will fill a form which has related controls to that category in it.</p>
<p>As I have many categories, I just want to have single ascx page and adding controls to it dynamically according to the user choice.</p>
<p>For example: One chose Telephone category, he will face a form having drop down lists asking, what brand? what color?
And one chose, book category, he will face drop down lists asking which type? howmany pages?</p>
<p>So 1 ascx must do my work at runtime done as I have alot of categories.</p>
<p>I am going to take these criterias from a database table which has CategoryID and Criteria colomns.</p>
<p>And if I can do that, will it be possible to add field validators to these dynamically created controls.</p>
<p>Nearly all controls are drop down list, if this helps.</p>
<p>Any help would be highly appreciated..</p>
<p>Thanks alot</p>
| c# asp.net | [0, 9] |
4,893,257 | 4,893,258 | How to change li position using Jquery | <pre><code><ul>
<li id="1">
<li id="2">
<li id="3">
<li id="4">
<li id="5">
<li id="6">
<li id="7">
</ul>
</code></pre>
<p>i want to make a function that foreach time the function is called the first li at the top will be the last one so the first example will look like this </p>
<pre><code><ul>
<li id="2">
<li id="3">
<li id="4">
<li id="5">
<li id="6">
<li id="7">
<li id="1">
</ul>
</code></pre>
<p>Thanks </p>
| javascript jquery | [3, 5] |
3,573,091 | 3,573,092 | Serialising POST requests jQuery/Javascript | <p>I am working on an application which sends an AJAX POST request (I'm using jQuery currently) every 1500ms. I have noticed that most of the times, these requests succeed within 350-450ms and are sent to the server nicely in the same order as they are generated. </p>
<p>However sometimes, one or two requests take nearly 3-4 seconds and they are delivered later. In my application I need to ensure that these requests are received by the server in the same order as they are sent from the client. How do I do that? I am using currently setInterval of 1500ms to call a function (which generates the data to be posted) and which POSTs it using $.ajax(). However, how do I serialise the requests?</p>
| javascript jquery | [3, 5] |
5,832,449 | 5,832,450 | Accessing script block with jquery | <p>I have a script block, in the div element which is appended after html response. I want to access this block and call eval() function for this script. How can I access the script block.</p>
<p>I tried <code>$("#divId script")</code> , but it doesn't work.</p>
<pre><code><div id="divId">
<script type="text/javascript">
// some code here
</script>
</div>
</code></pre>
| javascript jquery | [3, 5] |
2,284,767 | 2,284,768 | Should we refer to objects by their interfaces in Android platform | <p>I use to the advice given by Joshua Bloch's Effective Java, <code>Item 52: Refer to objects by their interfaces</code>.</p>
<p>However, in most of the sample code comes with Android, I realize the following code is quite common.</p>
<pre><code>private ArrayList<Integer> mPhotos = new ArrayList<Integer>();
</code></pre>
<p>I understand this is due to performance optimization purpose, as the following code will be slower.</p>
<pre><code>private List<Integer> mPhotos = new ArrayList<Integer>();
</code></pre>
<p>However, is such optimization technique still valid? As if I read from
<a href="http://developer.android.com/guide/practices/design/performance.html" rel="nofollow">http://developer.android.com/guide/practices/design/performance.html</a></p>
<blockquote>
<p>On devices without a JIT, it is true that invoking methods via a variable with an exact type rather than an interface is slightly more efficient. (So, for example, it was cheaper to invoke methods on a HashMap map than a Map map, even though in both cases the map was a HashMap.) It was not the case that this was 2x slower; the actual difference was more like 6% slower. Furthermore, the JIT makes the two effectively indistinguishable.</p>
</blockquote>
<p>Do we need to assume our devices are without JIT, and refer objects without interfaces? Or, shall we just adopt to Joshua Bloch's advice?</p>
| java android | [1, 4] |
1,073,908 | 1,073,909 | jquery or javascript active element on foreground, lock background? | <p>I have a layer that is presented by a logic var. </p>
<p>that layer is just a hidden div - how do I make it so the layer is the only element that can be interacted with on the page when it is visible?</p>
<p>thanks!</p>
<p>Update:</p>
<p>used a full size div in the background with a transparent gif - works in firefox, but not IE - thoughts?</p>
<pre><code>#overlay {
background-image: url('../images/transparent.gif');
width:100%;
height:100%;
z-index:8999;
display:none;
margin-top: 0;
margin-left:0;
position:fixed;
}
</code></pre>
| javascript jquery | [3, 5] |
2,236,077 | 2,236,078 | jQuery::List of image elements. Trying to make them into a slideshow | <p>I managed to design a small 4x4 grid filled with images. Currently, I am styling the ul element using jQuery.</p>
<pre><code><ul id="imagegrid">
<li>
<img src="...">
</li>
<li>
<img src="...">
</li>
</ul>
</code></pre>
<p>So, when I click an element inside this list it just zooms up and shows as a larger image. Now, if I want to simulate a slideshow, how would I go about doing it? Is there a good way through jQuery? (Using regular javascript, I was thinking of doing it using the setTimetout, but maybe jQuery does it better).</p>
| javascript jquery | [3, 5] |
3,444,513 | 3,444,514 | Is there any MIT licenced jquery pagination plugin? | <p>The famous <a href="http://archive.plugins.jquery.com/project/pagination" rel="nofollow">jQuery pagination plugin</a>
is of GPL licence. If I am not wrong to use a GPL licenced software in a product the product must be GPL licenced too. So I am looking for a pagination plugin which is MIT licenced. Any suggestions? </p>
| javascript jquery | [3, 5] |
3,609,192 | 3,609,193 | Posting Credentials to a basic authorization site and opening the link in a new browser. Open URL instead of a response | <p>The below code will post a request to an IIS basic authorization site. And sucessfully log in to the site using Windows Credentials. But what I need to do is convert this to opening the website in a browser much like opening a new hyperlink with a target="null".</p>
<p>So just a recap, how do you post the WebRequest to a new browser tab? Or how do you send the CredentialCache to a new URL request?</p>
<pre><code> var request = WebRequest.Create(testURL);
SetBasicAuthHeader(request, "username", "password", testURL);
var response = request.GetResponse();
}
public void SetBasicAuthHeader(WebRequest request, String userName, String userPassword, String testURL)
{
CredentialCache credentialCache = new CredentialCache();
credentialCache.Add(new System.Uri(testURL), "Basic", new NetworkCredential(userName, userPassword, "domain"));
request.Credentials = credentialCache;
request.PreAuthenticate = true;
}
</code></pre>
| c# asp.net | [0, 9] |
5,397,040 | 5,397,041 | reverse the order of the linked list | <p>i have a linkedlist, which add an object like a tree, the following is the printout
LinkedList nodeList = new LinkedList();</p>
<p>(result A)</p>
<pre><code>1 : Tester Meeting
2 : Adminstrative & Operational
3 : Functional Committees
4 : Aduit Committee
9 : Supporting Services Development
8 : Medical Services Development
7 : Information Technology Services
6 : Human Resources Committee
15 : test2-2
14 : test2
13 : test1-1
12 : test1
5 : Finance Committee
10 : Regional Advisory Committees
11 : Board Workshop
</code></pre>
<p>(result B)The following should be the right order</p>
<pre><code>Tester Meeting
Adminstrative & Operational
Functional Committees
Aduit Committee
Finance Committee
test1
test1-1
test2
test2-2
Human Resources Committee
Information Technology Services
Medical Services Development
Supporting Services Development
Regional Advisory Committees
Board Workshop
</code></pre>
<p>So, i want to reverse the order of sub-node of Audit Committee of (ResultA) output the result of same as the ResultB, is there any method to sort the specific node of linked list?</p>
| c# asp.net | [0, 9] |
1,376,912 | 1,376,913 | WebRequest.Timeout not working as expected | <pre><code>var strURL = "http://999.999.999.999"; // invalid IP-address
System.Net.WebResponse objResponse = default(System.Net.WebResponse);
System.Net.WebRequest objRequest = default(System.Net.WebRequest);
objRequest = System.Net.HttpWebRequest.Create(strURL);
objRequest.Timeout = 100;
objResponse = objRequest.GetResponse();
System.IO.StreamReader sr = new System.IO.StreamReader(objResponse.GetResponseStream());
result = sr.ReadToEnd();
</code></pre>
<p>The timeout I see through firebug is 3000 miliseconds... It shouldn't be that way!</p>
| c# asp.net | [0, 9] |
5,216,958 | 5,216,959 | Using Python vs PHP for Web Development - When and Where | <p>First of all, please don't make a comment that is based on your opinion or preferences or some magic hatred for PHP.</p>
<p>I work at a web development company and I'm going to write a new CMS soon. I'm currently using WordPress, but I have lots of experience with Python/Django.</p>
<p>My question to this great community is what are the practical benefits of using PHP or Python. What does Python give me that PHP doesn't <strong>that I'll actually use.</strong> Will Python add an extra level of complexity, will it allow better testing, etc etc.</p>
<p>I know this topics been beaten to death already, but most of the replies on objective. I want facts that are of <strong>actual use to people.</strong> </p>
<p>Some Topics:</p>
<ul>
<li>Security</li>
<li>Speed</li>
<li>Easy of use</li>
<li>Scalability</li>
<li>Maintainability</li>
<li>Extendability </li>
</ul>
<p>Thanks :)</p>
| php python | [2, 7] |
5,328,133 | 5,328,134 | find howmany words are starting with given search string - Regex | <p>I am working on regex for searching hotel list. There are names like "testing hotel plaza", "testing2 newhotel plaza", "plaza hotel"....</p>
<p>basically my requirement is if user type plaza then all the hotels should populate which contains "Plaza"....but if user types "aza" no result should populate. In short in given string I need to find is there any word that start with user entered string and if yes, then display the result...Please advice</p>
<p>here is a code that I am stuck and is not working...</p>
<pre><code>var regex = new RegExp("/\b"+searchString, "gi");
if (mainString.match(regex))
{
return true;
}
</code></pre>
<p>This is working but it is finding all occurance even if it is a middle character or at any position..which I do not want</p>
<pre><code> var regex = new RegExp(searchString , "gi");
if (mainString.match(regex))
{
return true;
}
</code></pre>
| javascript jquery | [3, 5] |
382,486 | 382,487 | how to write the condition in jquery? | <p>I have two text input fields like so:</p>
<pre><code><input type="text" id="test1".../>
<input type="text" id="test2".../>
</code></pre>
<p>Now I want the visitor to only be able to fill in only one of those text inputs. For example, if <code>#test1</code> has a value, when the visitor tries to enter a value into <code>#test2</code>, an alert a box should say "Fill in either test1 or test2 but not both".</p>
| javascript jquery | [3, 5] |
4,104,916 | 4,104,917 | JQuery recursive function? | <p>How can I call a function from inside the function, so it becomes recursive? Here is my code, I have added a comment where I would like to start the recursion:</p>
<pre><code>$('a.previous-photos, a.next-photos').click(function() {
var id = $('#media-photo img').attr('id');
var href = $(this).attr('href');
href = href.split('/');
var p = href[href.length - 1];
var url = '/view/album-photos/id/' + id + '/p/' + p;
$.get(url, function(data) {
$('.box-content2').replaceWith('<div class="box-content2"' + data + '</div>');
});
// here I want to call the function again
return false;
});
</code></pre>
| javascript jquery | [3, 5] |
5,598,857 | 5,598,858 | Simple Javascript not Working - Jquery | <p>I have the following in my page.</p>
<pre><code>$(document).ready(function() {
function setTheTimeout(){
var t=setTimeout("alertMsg()",3000);
}
function alertMsg(){
alert("Hello");
}
setTheTimeout();
});
</code></pre>
<p>I am getting an error in Firebug alertMsg() is not defined?</p>
| javascript jquery | [3, 5] |
1,339,329 | 1,339,330 | Is there a way to detect mouse press in jQuery? | <p>I want to add a class to a link when it is clicked, but I can't use:</p>
<pre><code>$('a.someLink').click(function() {
// code
});
</code></pre>
<p>since click seems to detect when a user clicks and lets go of the mouse clicker on an element. I need to add the class as soon as the user has clicked on the element, even before he lets ago of the mouse clicker and after he lets go I need the class to be removed.</p>
<p>Basically I'm trying to mimic css's active state on links:</p>
<pre><code>a:active
</code></pre>
<p>How can this be done?</p>
| javascript jquery | [3, 5] |
1,129,294 | 1,129,295 | jQuery determining if element exists on page | <p>How can I determine if an element exists on a page... for instance... </p>
<pre><code>$('select[name="modifier_option"]')
</code></pre>
<p>If that select box exists on the screen I need to validate it's value on the page to ensure it's value is > 0, but if it doesn't exist I don't need to worry about it.</p>
| javascript jquery | [3, 5] |
512,428 | 512,429 | In JQuery, how do I check if the DOM is ready? | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1206937/javascript-domready">javascript domready?</a> </p>
</blockquote>
<p>I want to check whether <code>$(function(){ });</code> is "ready".</p>
<p>Return true if DOM is ready, false otherwise</p>
| javascript jquery | [3, 5] |
5,807,825 | 5,807,826 | Get Touch Coordinates Relative To A View (ScreenToClient Equivalent?) | <p>I have an image I am displaying to a user in my android application.</p>
<p>I want to be able to tell where they 'touch' the image.</p>
<p>I can easily get the screen coordinates by implementing an OnTouchListener</p>
<pre><code> private OnTouchListener image_Listener = new OnTouchListener(){
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_UP) {
float x = event.getX();
float y = event.getY();
return true;
}
return false;
}
};
</code></pre>
<p>However, these are absolute coordinates. What I really need is a function to convert this into coordinates relative to a View..</p>
<p>I have done a bit of digging, but I can't seem to turn up anything, aside from me trying to implement a ScreenToClient method myself..</p>
<p>Does anyone know of a good solution to this, or am I just going to have to roll my own?</p>
<p>It seems like the kind of method that would be available - that's why I'm asking.</p>
<p>Thank you all for your time.</p>
<p>EDIT: I'm not so sure that the coordinates aren't already relative to the view. I could have swore reading that coordinates were absolute, but after some tinkering - I have things working as I expected.. Sorry for the noise guys.</p>
| java android | [1, 4] |
3,816,550 | 3,816,551 | why do we use HttpContext.Current? | <p>i don't know, why do we use HttpContext.Current?<br />
in this property i use it for Session but i don't know why! </p>
<pre><code>public static string Name
{
get
{
if (HttpContext.Current.Session["_n_"] != null)
return HttpContext.Current.Session["_n_"].ToString();
else return "";
}
set
{
HttpContext.Current.Session["_n_"] = value;
}
}
</code></pre>
| c# asp.net | [0, 9] |
2,552,652 | 2,552,653 | div does not animate in jquery. why? | <p>I created a <a href="http://jsfiddle.net/pesAA/2/" rel="nofollow">fiddle</a>. I am trying to make jquery animation but when I click on the link it does not move. Why? I am using jquery transition plugin.</p>
<p>Here is my code</p>
<p>html</p>
<pre><code><header class="header"><a href="#" class="click">Click</a></header>
<section class="contents">
<section class='home'>
Hello akdjalskdjalskdjlasklasdjasljdasök
</section>
</section>
</code></pre>
<p>css</p>
<pre><code>.contents {
width: 300px;
height: 400px;
border: 1px solid red;
}
.home {
position: absolute;
border: 1px solid green;
}
</code></pre>
<p>and js</p>
<pre><code>$('.click').click(function () {
$('.home').transition({x: '+100px'}, function () {
alert('completed');
});
});
</code></pre>
<p><strong>Update</strong></p>
<p>I am using jquery <a href="http://ricostacruz.com/jquery.transit/" rel="nofollow">transition</a> plugin</p>
| javascript jquery | [3, 5] |
5,143,983 | 5,143,984 | How to compare Time in java/android (given input in strings)? | <p>I have two strings which are used to store time in the format <strong>hh:mm</strong>.I want to the compare these two to know which time is greater.Which is the easiest way to go about this?</p>
| java android | [1, 4] |
5,557,958 | 5,557,959 | An unwanted object in the last cell of an array | <p>I'm using the following code on a parsed XML array: </p>
<pre><code>$(this).find("cp_group").each(function() {
$("select#comp_1").append('<optgroup label="' + $(this).attr('label') + '"><option>' + $(this).find("cmp").map(function() {
return $(this).text();
}).get().join("</option><option>") + $(this).append('</option></optgroup>'));
});
</code></pre>
<p>And i get an unwanted [object Object] in the last option of each option group as following:</p>
<pre><code><select name="comp_1" id="comp_1">
<optgroup label="Combat">
<option>Arme</option>
<option>Arts martiaux</option>
<option>Esquive</option>
<option>Feinte</option>
<option>Parade</option>
<option>Lutte[object Object]</option>
</code></pre>
<p>I dont understand from where this [object Object] come from and I didn't achieve to not get it or to remove it.
Thanks for you help.</p>
| javascript jquery | [3, 5] |
166,251 | 166,252 | Requests with Jquery | <p>Currently I'm trying to add on to the auto-complete module for jquery that is out there. After i've auto-completed my text field, i tab to my next field (a drop down). When that drop down is focused, i want to check against my text field and populate the drop down with a specific list depending on what the text field has.</p>
<p>Is this something jquery can do? I know I can do this by appending a script tag, and passing values back with json, but wanted to know if I could do something similar to this with jquery.</p>
<p>Thanks in advance.. still discovering this wonderful framework!</p>
| php jquery | [2, 5] |
1,162,542 | 1,162,543 | jquery menu - active links | <p>I am trying to make a jquery menu that when I click on one of the links (with reloading the page), it changes its class to "active" and removes this class when I click on another link.</p>
<p>here is my code :</p>
<p>enter code here`$(document).ready(function(){</p>
<pre><code>$(function(){
$("a").click(function(){
$(this).parent().addClass('inny').siblings().removeClass('inny');
});
});
});
<ul id="mainMenu">
<li class="hover-width1"><a href="d.html">STRONA GŁÓWNA</a></li>
<li class="hover-width3"><a href="glowna.html">OFERTA</a></li>
<li class="hover-width3"><a href="d2.html">CENNIK</a></li>
<li class="hover-width2"><a href="tom.html">PRZEPISY</a></li>
<li class="hover-width2"><a href="jan.html">GALERIA</a></li>
<li class="hover-width1"><a href="#">NASI KLIENCI</a></li>
<li class="hover-width2"><a href="#">NARZĘDZIA</a></li>
<li class="hover-width1"><a href="#">CIEKAWOSTKI</a></li>
<li class="hover-width2"><a href="#">KONTAKT</a></li>
</ul>
</code></pre>
<p>Can someone tell me why my code is not working when I reload the page:(</p>
| javascript jquery | [3, 5] |
990,964 | 990,965 | setInterval onclick of #fr_tab div and clear on click of anywhere in document | <p>I have this jquery code: </p>
<pre><code> $('#fr_tab').click(function() {
$("#tab2").empty().html('<img src="images/loading.gif" />');
var handle = setInterval(function () {
$('#tab2').load('fr_quests.php');
}, 3000);
});
$('body').click(function() {
if (handle) {
clearInterval(handle);
handle = 0;
}
});
</code></pre>
<p>I was wondering how I can setIneterval when #fr_tab is clicked and how I can clear it if anywhere in the document has been clicked.</p>
| javascript jquery | [3, 5] |
5,369,853 | 5,369,854 | Python - List of Strings to Java | <p>I'm getting a list of strings from python code and need to read it in Java. When trying to read it, i get the hashCode</p>
<blockquote>
<p><code>[Ljava.lang.Object;@7cf1bb78</code></p>
</blockquote>
<p>I want to read the values in a list. In python my return is something like</p>
<pre><code>return SUCCESS(OK, params={'data':nameList()})
</code></pre>
<p>How would I read this in Java and print the contents not the hashCode. Currently I'm doing like</p>
<pre><code>Object getNames = new Object();
getName = getNameList(); // This is thru Apache XML RPC Client
System.out.println(getName);
</code></pre>
<p>Any help or suggestions?</p>
| java python | [1, 7] |
2,395,775 | 2,395,776 | Configuration settings in (web.config|app.config) versus a Static Class Object | <p>I am just looking at the BlogEngine.Net source code and was intrigued at how it stores application settings.</p>
<p>Instead of using web.config or app.config which I am accustomed to, the source uses a static class object implemented using a singleton pattern to achieve the application settings. the information is still stored in a settings file but any calls to retrieve information is done via the class object which preloaded all information into property values.</p>
<p>Any advantages of different approaches?</p>
| c# asp.net | [0, 9] |
647,276 | 647,277 | Variable in a Closure | <p>I have a JS object, in a property I use a function expression, within a variable result.</p>
<p>I need to populate the result variable and return it when processData has been invoketed.</p>
<p>Could you tell me what I'm doing wrong here, if you brief explain the problem and add a pieec of good would be great.</p>
<pre><code>$(document).ready(function () {
// General Settings
var
ApiSettings = {
clientId: 'aaa',
clientSecret: 'bbb'
}
ApiSettings.uriGetToken = 'https://ccc.com/oauth/token?grant_type=client_credentials&client_id=' + encodeURIComponent(ApiSettings.clientId) + '&client_secret=' + encodeURIComponent(ApiSettings.clientSecret);
ApiSettings.token = (function () {
var result; // I'm not able to set this variable
// Make an Ajax Request
$.getJSON(ApiSettings.uriGetToken, processData);
function processData(data) {
result = data.access_token;
}
return result;
})();
console.log(ApiSettings);
console.log(ApiSettings.uriGetToken);
console.log('FINAL:' + ApiSettings.token);
});
</code></pre>
| javascript jquery | [3, 5] |
4,172,110 | 4,172,111 | How to make something load at an event rather than on page-load | <p>So the situation is for comments on a blog in progress, each commenter will have the ability to reply to any comment. To do this, I have a link that, when clicked, will reveal (with jQuery) a special reply form right there as opposed to the normal one at the bottom of the page. So instead of loading a form on every single comment when the page loads, I'd like to load only the forms that are needed by the user and only when they click on the link. </p>
<p>Now, I don't simply want to hide them, I know how to do that. I want them to not be there at all until that link is clicked. So can this be done? You don't need to tell me exactly how to do it (all though I may be back here later for something specific) If you just give me a search term, or a brief overview that would be awesome! Thanks!! </p>
| javascript jquery | [3, 5] |
507,611 | 507,612 | Multiple TextViews in a SurfaceView | <p>I am creating an android game, I tried using the canvas.drawText() method to display my score and level but it caused errors. Now I am trying to use TextViews to display them, I am using a SurfaceVeiw and I wanted to know is it possible and would it be a good way of doing it. </p>
| java android | [1, 4] |
1,644,490 | 1,644,491 | Need to enable/disable a button on click of checkbox | <p>I am trying to disable a order button when the page loads and enable it when one checks the Terms and condition checkbox. I have it working where the order button is disabled when the page loads but on the click of checkbox the button doesnt get enabled. Here is my code. Can anyone help me identify the problem</p>
<pre><code> <input type="checkbox" id="checkbox1" name="checkbox1" class="required" />Please read the <a href="#">Terms and Conditions</a>
</code></pre>
<p>Jquery Code</p>
<pre><code> var j$ = jQuery.noConflict();
j$(document).ready(function(){
alert("Hi");
if(j$('input[name="checkbox1"]').not(":checked"))
{
j$('input[name="Order"]').attr('disabled', 'disabled');
}
else
{
j$('input[name="Order"]').removeAttr('disabled');
}
j$('#checkbox1').change(function(){
if(j$('input[name="checkbox1"]').is(":checked")
{
j$('input[name="Order"]').attr('disabled', 'disabled');
}
else
{
j$('input[name="Order"]').removeAttr('disabled');
}
}
});
</code></pre>
<p>Thanks</p>
<p>Prady</p>
| javascript jquery | [3, 5] |
3,939,752 | 3,939,753 | Spellchecker not working when text contains an url | <p>I am using one free spellchecker named pure javascript spell checker.But right now if somebody enters a url(starting with http://) in the text area and then do a spell check in that case its showing error in Firefox but in IE its working fine.So is there any way in javascript to escape an entire url from the user inputted text ?</p>
| javascript jquery | [3, 5] |
3,894,078 | 3,894,079 | manipulating radio box selection with javascript | <p>i'm trying to do a poll but i designed it without any radio box in it. So i decided to make the selection being highlighted with a different background color, all is done with jquery.</p>
<p>I set the display of the radio box to none so that it wouldn't show, gave each a unique ID. Here's the script.</p>
<pre><code><form action="v_poll.php" method="post">
<ul class="voting">
<li class="voting votetext"><input type="radio" name="voting" value="a1" style="display:none;" id="a1"><a onClick="vote('a1')"Answer 1</a></li>
<li class="voting votetext"><input type="radio" name="voting" value="a2" style="display:none;" id="a2"><a onClick="vote('a2')">Answer 2</a></li>
<li class="voting votetext"><input type="radio" name="voting" value="a3" style="display:none;" id="a3"><a onClick="vote('a3')">Answer 3</a></li>
<input type="hidden" value="1" name="id" />
<input type="submit" value="submit">
</ul>
</form>
<script type="text/javascript">
function vote(TheValue) {
GetElementById(TheValue).checked=true;
}
</script>
</code></pre>
<p>But when i checked the value of the radio box with $_POST['voting'], it is blank. Not the value assigned to the radio box. Anything i'm doing wrong?</p>
<p>Please help. Thanks.</p>
| php javascript | [2, 3] |
3,676,424 | 3,676,425 | Append text to iFrame body where users mouse is "blinking" | <p>I need to append a face icon to the body of a iframe. The problem I am having is that it is put at the end of the body, not where the user has the insertion point.</p>
<p>Here is the code I have so far,</p>
<pre><code> <iframe style=""name="content" id="content" width="758" height="200" onload="javascript:load();"></iframe>
function angleFace()
{
$("#content").contents().find("body").append('<img title="Angle" src="/media/angle.png" alt="Angle">');
}
</code></pre>
<p>I want the face to be put wherever the users insertion point is at. Right now the face is being put at the end of the document.</p>
<p>Side note - You type into the iFrame then on the submit it is transfered to the textarea then entered into the database.</p>
| javascript jquery | [3, 5] |
1,029,597 | 1,029,598 | How to write this in a simpler less ridiculous way | <p>This just seems absurd to me. Should I use array instead or is there some other better solution?</p>
<pre><code>$('.hoursRange').change(function() {
if ('0' == $(this).val())
{
$(this).val('00');
return false;
}
if ('1' == $(this).val())
{
$(this).val('01');
return false;
}
if ('2' == $(this).val())
{
$(this).val('02');
return false;
}
if ('3' == $(this).val())
{
$(this).val('03');
return false;
}
if ('4' == $(this).val())
{
$(this).val('04');
return false;
}
if ('5' == $(this).val())
{
$(this).val('05');
return false;
}
if ('6' == $(this).val())
{
$(this).val('06');
return false;
}
if ('7' == $(this).val())
{
$(this).val('07');
return false;
}
});
</code></pre>
| javascript jquery | [3, 5] |
366,897 | 366,898 | jQuery calculation doesn't add up as expected when toggling height | <p>I have the following function for calculating the height of <code>.node</code>. It then takes away the height of a possible image, <code>.node-image</code>, from the height of the <code>.node</code>, and sets a column, <code>.node-content-column</code> to have a height that is the difference (i.e. 500 - 50 = 450; column becomes 450 in height).</p>
<pre><code>function initColumnSizer() {
imageHeight = $('.node-image').outerHeight(true);
resizeHeight = ($('.node').outerHeight() + 75) - imageHeight;
$('.node-content-column').removeAttr('style');
$('.node-content-column').css('min-height', resizeHeight);
$('.node-content-column').css('height', 'auto !important');
$('.node-content-column').css('height', resizeHeight);
}
</code></pre>
<p>This function gets called on page load, and resizes <code>.node-content-column</code> as expected. </p>
<p>It also gets called when a div within <code>.node</code> is toggled using <code>jQuery.toggle()</code>, but this calculation returns a larger number everytime, instead of reverting back to the original once this toggle is reverted. </p>
<p>Can anyone see where I am going wrong with this calculation? Or if I am going about it the wrong way?</p>
<p>Thanks in advance!
Karl</p>
| javascript jquery | [3, 5] |
4,111,157 | 4,111,158 | Check if a radio selection is made | <p>I am having trouble checking whether there is a radio selection is not made in my form. In my form, I have 5 items, each item is given 2 options (radio buttons). Something like this:</p>
<pre><code>item 1 opt1 opt2 (name attribute is "1")
item 2 opt1 opt2 (name attribute is "2")
item 3 opt1 opt2
item 4 opt1 opt2
item 5 opt1 opt2
</code></pre>
<p>I have given all input radio buttons the same class name as items are generated dynamically, so are the name attribute of the input. Here is my code of check each item:</p>
<pre><code>$(document).ready(
function(){
$('#submit').click(function(){
var buttons = document.getElementsByClassName('radio_class');
var radio_num = buttons.length; //which returns 10 in this case
var error = "";
for (var i=0; i<radio_num; i=i+2){
var radio_name = buttons[i].getAttribute("name");
if (!$("input[@name=radio_name]:checked").val()) {
error += radio_name + " ";
}
}
if (error !== "") {
alert (error+"not checked!");
return false;
}
else {
alert ("All the items have been checked.")
}
}
);
}
);
</code></pre>
<p>If all the five items are not checked, it alerts the correct message that is "1 2 3 4 5 not checked", however, if I just check one item, the message "All the items have been checked." will be alerted. Can anyone help me with this? Thanks.</p>
| javascript jquery | [3, 5] |
1,212,038 | 1,212,039 | how to compare two text input type box values using jquery | <p>I have a two textboxes <code>t1</code> and <code>t2</code> . I would like to figure out how in jquery if the values in <code>t1</code> and <code>t2</code> are same I can display an alert message. If user does not change the values I want to prevent the form from being submitted.</p>
| javascript jquery | [3, 5] |
2,760,753 | 2,760,754 | Global variable in javascript not working properly | <p>I have an iframe issue ( little bit strange for me ) . The issue is that i have an iframe in my document, and there are several functions are operating different task on that iframe and for accessing the contents of iframe we use :</p>
<pre><code>$("iframe").contents();
</code></pre>
<p>So instead of writing this long statement i used a global variable :</p>
<pre><code>var i = $("iframe").contents();
</code></pre>
<p>But this is not working well, like</p>
<pre><code>alert( i.find("someelement") );
</code></pre>
<p>=> <code>undefined</code> </p>
<pre><code>alert($("iframe").contents().find("someelement")
</code></pre>
<p>=> <code>[object]</code></p>
<p>Whats the problem here?</p>
| javascript jquery | [3, 5] |
2,065,863 | 2,065,864 | push an apk file into assets folder programmatically in android | <p>Can i push an apk file into my assests folder programmatically?I wanted to use this apk file
in my application.</p>
<p>Please forward your valuable suggestions to me.</p>
<p>Thanks in advance...
Priya</p>
| java android | [1, 4] |
5,974,635 | 5,974,636 | Reusing a menu onclick events in android app | <p>I'm new to android but experienced in non OOP languages (mostly vb and PHP)</p>
<p>However java and android seems hard to lean...</p>
<p>However i gotten fairly long with my app so far. Now i want to reuse my custom built bottom menu (i created the graphics myself, and includes it in the layout file with the include command)</p>
<p>But now i would like to include all the onclick events that opens up a new activity. (instead of just copy paste everyting and make the app bigger) Is there somehow easy/standard way of doing this (please bear in mind that i'm not good at OOP languages and especially java :-( )</p>
<p>So any hint and extra explanation on the commands would make me very happy :o)</p>
| java android | [1, 4] |
4,293,193 | 4,293,194 | How to get a box to appear from the top of the browser window on page load? | <p>I want a box to appear from the top of the browser window upon page load.</p>
<p>Ideally it would look like this:</p>
<p><a href="http://demo.cookieconsent.silktide.com/" rel="nofollow">http://demo.cookieconsent.silktide.com/</a></p>
<p>So the page loads and this slides down. </p>
<p>How would I achieve this?</p>
<p>I have looked at <a href="http://jqueryui.com/demos/dialog/" rel="nofollow">http://jqueryui.com/demos/dialog/</a> but it doesn't do the above it seems.</p>
| javascript jquery | [3, 5] |
4,190,826 | 4,190,827 | Why my Uri , is not fetched by ACTION_DIAL in android? | <p>I have found that the following code is working perfectly : </p>
<pre><code>Intent intent = new Intent( Intent.ACTION_DIAL , Uri.parse("tel:555-2368") );
</code></pre>
<p>But when I tried the code below, it is not working. I am trying to create a URI by reading from a file.</p>
<pre><code>File f = new File ( "tushar.txt") ;
f.createNewFile() ;
fw = new FileWriter(f) ;
bfr = new BufferedWriter(fw);
bfr.write("9654309293") ;
bfr.write("9876543210") ;
Uri u = Uri.fromFile(f) ;
Intent intent =
new Intent(Intent.ACTION_DIAL, u);
</code></pre>
| java android | [1, 4] |
1,902,451 | 1,902,452 | how to prevent $(document).ready(function() {} from calling a function | <p>i have a simple but bit complicated problem.
what i want to do is that in my php page i have added this</p>
<pre><code>$(document).ready(function() {
$("a[rel^='prettyPhoto']").prettyPhoto({social_tools:false,overlay_gallery:false});
});
</code></pre>
<p>now this page get call through ajax too.normal call of page does <strong>nothing</strong>.but when i click i mean <code>a[rel^='prettyPhoto']</code> so it call this function prettyPhoto() and that is what i want to do.
when this page call through ajax so it directly execute the function although i have not click any thing.</p>
<p>i have tried this</p>
<pre><code>event.preventDefault();
</code></pre>
<p>but nothing working.
also i put this line of code in a function and call it but nothing happens.also remove <code>$(document).ready(function() {}); but still not working any clue</code></p>
| javascript jquery | [3, 5] |
2,960,558 | 2,960,559 | Possible to put Exception Try/Catch Error Messages to Textbox on first page? | <p>Usually error messages are thrown to a new webpage when I get some sort of <code>SocketException</code>, <code>WebException</code>, etc.</p>
<p>Instead of being redirected to a new page with the error messages, is it possible to get the error to show in a textbox on the first page?</p>
| c# asp.net | [0, 9] |
3,776,153 | 3,776,154 | JS: setInterval and clearIntervals with jQuery | <p>I'm probably tired for staring at this for too long,
maybe someone can clear this up for me:</p>
<pre><code>//scripts in whispers are setup this way.
var something = function(){
setInterval(function1,1000);
setInterval(function2,1000);
blah .. blah...
}
//function2 is the same as this one
var function1 = function(){
ajax to do something on server
blah...
blah...
}
//button to stop things from running anymore
$('.stop').live('click',function(){
clearInterval(function1);
clearInterval(function2);
return false;
}
</code></pre>
<p>I should be able to stop function1 and/or 2 from running after
clicking the button yeah? For some reason - the ajax calls within the
two functions keep running and pinging the server.</p>
| javascript jquery | [3, 5] |
553,754 | 553,755 | Rotated image in ImageView | <p>I want to show an arrow that indicates the direction towards a goal, using the orientation sensor and current GPS position. Everything works well, except that I want to rotate the arrow image in my ImageView.</p>
<p>The current code, which shows the arrow pointing upwards, is this:</p>
<pre><code>ImageViewArrow.setImageResource(R.drawable.arrow);
</code></pre>
<p>What is the best solution for showing the arrow, rotated by N degrees?</p>
<p>I tried this, but it gave messed up graphics:</p>
<pre><code>Matrix matrix = new Matrix();
matrix.postRotate(Rotation);
Bitmap bitmapOrg = BitmapFactory.decodeResource(getResources(),
R.drawable.arrow);
Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0,
bitmapOrg.getWidth(),bitmapOrg.getHeight(), matrix, true);
BitmapDrawable bmd = new BitmapDrawable(resizedBitmap);
InfoArrow.setScaleType(ScaleType.CENTER);
InfoArrow.setImageDrawable(bmd);
</code></pre>
| java android | [1, 4] |
5,007,449 | 5,007,450 | Merge two similar click event into one | <p>this is a recurrent problem in writing my javascript : I have the events :</p>
<pre><code>$(document).on('click','.mi_piace_brick',function(){
$this = $(this).children(),
$that = $(this),
i = s.get_current_step_id(),
j = $that.attr('data-class'),
counter = parseInt($('.like_counter_'+i+'_'+j).first().find('p').text());
if($this.hasClass('liked')){
$this.removeClass('liked');
$('.like_counter_'+i+'_'+j).find('p').text(--counter);
}
else{
$this.addClass('liked');
$('.like_counter_'+i+'_'+j).find('p').text(++counter);
}
})
</code></pre>
<p>And </p>
<pre><code> $(document).on('click','.pref_brick',function(){
$this = $(this).children(),
$that = $(this),
i = s.get_current_step_id(),
j = $that.attr('data-class'),
counter = parseInt($('.fav_counter_'+i+'_'+j).first().find('p').text());
if($this.hasClass('preferito')){
$this.removeClass('preferito');
$('.fav_counter_'+i+'_'+j).find('p').text(--counter);
}
else{
$this.addClass('preferito');
$('.fav_counter_'+i+'_'+j).find('p').text(++counter);
}
})
</code></pre>
<p>As you can see, the two functions are basically really similar. I'm encountering really often in such situations. There's a way, in your opinion, to use only one binding to do the trick?</p>
| javascript jquery | [3, 5] |
1,751,557 | 1,751,558 | Always center div in the middle of screen | <p>My object is to have popup appear on the center of screen. Everything works fine with default zoom on PC and tablets with "Matt Coughlin" <a href="http://stackoverflow.com/questions/11364959/how-to-center-getting-data-on-mobile-screen?answertab=active#tab-top">answer</a>, but things starts to break when zooming in. </p>
<p>Popup div jumps out of the screen most of the times and therefore is unusable on smaller devices.</p>
<p>I have tried to find a way for a while now and nothing really works. Is there even a way to get center of a screen, not page? </p>
<p>Basically when you press open popup, it aligns center of the area. If you scroll it a bit right and repress open popup, then result is the same, but while zooming in mobile devices, then it won't work anymore. Code example, which aligns popup in the middle of screen (el is the popup element)</p>
<pre><code>var pos = document.body.getBoundingClientRect();
var left = ((window.innerWidth >> 1) - pos.left) - (el.width() >> 1);
var top = ((window.innerHeight >> 1) - pos.top) - (el.height() >> 1);
</code></pre>
<p><a href="http://jsfiddle.net/ceujq/3/" rel="nofollow">JSFIDDLE EXAMPLE</a></p>
| javascript jquery | [3, 5] |
4,124,066 | 4,124,067 | Phone doesn't go to sleep? | <p>Is it possible that if phone's screen turns off completely but phone does not go to sleep?</p>
<p>I have an app which do some things when device goes to sleep. I registered broadcast intent: Intent.ACTION_SCREEN_OFF</p>
<p>On my device app works fine ( HTC Desire, cyanogenmod ). When screen turns off, my app is activated.</p>
<p>I tried app on another phone (HTC Wildfire S, offical gingerbread ), and here is the strange part. When screen goes off my app is not activated (sometimes it is, like 10%). So i connected it with my LOGCAT and i wanted to see if device actually goes to sleep when screen is turned off, and the thing is that when is connected with my PC, device ALWAYS goes to sleep and my app is activated.</p>
<p>On emulators from froyo to jelly bean app works perfect. Is problem in my app?</p>
| java android | [1, 4] |
2,829,627 | 2,829,628 | jquery form wizard and validation | <p>i am trying to use the jquery form wizard with asp.net to create a multi step form. I have already built the form, but i am having problems during validation of emails. I have two form fields email and confirm email which should match before going to the next step.
The problem i am having is I am using master pages and so my control id is getting renamed.The validationOptions of jquery form wizard seems to be looking at the name property of input control rather than ID, so setting clientidmode is not working as well. I am looking for suggestions or alternatives on how to make this work.</p>
<p>Here is my markup</p>
<pre><code> <label for="txtconfemail">Confirm Email</label>
<asp:TextBox CssClass="input_field_12em" runat="server" ID="txtconfemail" ClientIDMode="Static"></asp:TextBox>
</code></pre>
<p>Here is my javascript. This code only checks for required (not the equalTo) and even that does not work.</p>
<pre><code> <script type="text/javascript">
$(function () {
$("#myform").formwizard({
formPluginEnabled: true,
validationEnabled: true,
focusFirstInput: true,
formOptions: {
success: function (data) { $("#status").fadeTo(500, 1, function () { $(this).html("You are now registered!").fadeTo(5000, 0); }) },
beforeSubmit: function (data) { $("#data").html("data sent to the server: " + $.param(data)); },
dataType: 'json',
resetForm: true
},
validationOptions: {
rules: {
txtconfemail : {
required: true
}
},
messages: {
txtemailconf:
{
required:"Email is required"
}
}
}
}
);
});
</script>
</code></pre>
<p>If i replace txtemailconf with ctl100$MainContent$txtconfemail, then my validation gets fired.</p>
| jquery asp.net | [5, 9] |
2,595,218 | 2,595,219 | has no method 'replace' jquery error | <p>I got the following js code which is erroing in the console and i'm not too sure of what i'm doing wrong. Basically i'm trying to get a list of fields so i can do some calcs on.</p>
<pre><code>var LabourItems = {
rate: null,
hours: null,
total: null,
init: function(object) {
var rate = $(object).children('.rate').first();
var hours =$(object).children('.hours').first();
total = rate * hours;
updateTotal(object,total);
},
updateTotal: function(object, total) {
$(object).children('.total').first().attr('value', total)
}
}
//reactTochange for those inputs that you want to observe
$('.hours').live(function() {
var labourItems;
jQuery.each($('.labouritems'), function(key,value){
labourItems.push(LabourItems.init(value));
});
});
</code></pre>
<p>Console Error:</p>
<pre><code>Uncaught TypeError: Object function () {
var labourItems;
jQuery.each($('.labouritems'), function(key,value){
labourItems.push(LabourItems.init(value));
});
} has no method 'replace'
</code></pre>
| javascript jquery | [3, 5] |
2,460,918 | 2,460,919 | getting comma before first element in an array in jquery | <p>I am inserting some data into an array but I am getting </p>
<pre><code>,9,My firstname,My lastname,[email protected],123456789
</code></pre>
<p>out in my console. How can I remove comma from first element i.e. 9? here is my code</p>
<pre><code>var data = new Array();
$(row_el.children("td")).each(function(i) {
var td = $(this);
//var data = td.html();
var td_el = td.attr('class');
//arr[i] = data;
if(!td.hasClass("element")) {
data[i] = td.html();
console.log(i + ": " + data);
}
});
</code></pre>
<p>I want output like this </p>
<pre><code>9,My firstname,My lastname,[email protected],123456789
</code></pre>
<p>then I will pass this array to a function and loop through this array.</p>
| javascript jquery | [3, 5] |
163,165 | 163,166 | Return either local variable or GET results | <p>I would like to return x || $.get.</p>
<p>Or in other words, if x is true, then return x, else perform a GET call and return the value provided by the server.</p>
<p>My attempt is listed below (ideally, it would follow the return x || y format maybe with an anonymous function? instead of the if/then).</p>
<p>Problem is my return from my $.get function appears not to be what I expected.</p>
<p>Would appreciate an explanation of what is going on.</p>
<p>Thanks</p>
<pre><code>$(function(){
function test(x,y) {
if(x==true) {return true;}
else{
//test.php is echo($_GET['y']==123);
$.get('ajax.php',{'y':y},function (status) {return status;});
}
}
alert(test(false,123));
});
</code></pre>
| javascript jquery | [3, 5] |
2,707,118 | 2,707,119 | How to fetch the value of selected checkbox inside a checkboxList? | <p>I want to know the selected value of the markup below. So that I can disabled a textbox, if one of the checkbox is selected.</p>
<pre><code> <asp:CheckBoxList ID="ChkTest" runat="server" RepeatDirection="Horizontal" CssClass="toggleYesNo">
<asp:ListItem Value="1">Yes</asp:ListItem>
<asp:ListItem Value="0">No</asp:ListItem>
</asp:CheckBoxList>
</code></pre>
<p>I tried using this function it doesnot seem to work</p>
<pre><code>$(document).ready(function() {
$("#<%=ChkTest.ClientID %>").click(function() {
value = $(this).val();
if(value=='1') {
$('#atextbox').attr('disabled','');
}
else {
$('#atextbox').attr('disabled','disabled');
}
});
});
</code></pre>
<p>I also track the output HTML but the id the CheckBoxList the assigned to a table instead.</p>
<p><strong>UPDATED</strong></p>
<pre><code><table id="ChkTest" class="toggleYesNo" border="0">
<tr>
<td><input id="ChkTest_0" type="checkbox" name="ChkTest$0" /><label for="ChkTest_0">Yes</label></td><td><input id="ChkTest_1" type="checkbox" name="ChkTest$1" /><label for="ChkTest_1">No</label></td>
</tr>
</table>
</code></pre>
| c# asp.net jquery | [0, 9, 5] |
4,653,991 | 4,653,992 | e.which codes for CTRL + A and CTRL + E | <p>Can anybody please tell me e.which codes for key press <kbd>CTRL</kbd> + <kbd>A</kbd> and <kbd>CTRL</kbd> + <kbd>E</kbd>.</p>
<p>Also please tell me where i can find these values, i tried searching google but no appropriate results and i dont want shortcuts plugin for simple needs.</p>
<p>Thank You.</p>
| javascript jquery | [3, 5] |
151,931 | 151,932 | separate a string in c# | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1219094/separate-firstname-and-lastname-from-fullname-string-in-c">Separate firstname and lastname from fullname string in C#</a> </p>
</blockquote>
<p>I want to split a string which is like lastname, firstname. I only need the first name how to do that. How to split the string</p>
<pre><code> for (int counter = 0; counter < ListBoxMembers.Items.Count; counter++)
{
string FirstName = ListBoxMembers.Items[counter].Value;
</code></pre>
<p>It takes the whole string i just need firstname</p>
| c# asp.net | [0, 9] |
1,513,131 | 1,513,132 | jquery closest() doesn't work | <p>I am trying to grab the closest link with the class <code>a.tariff-link</code> and send it to a method, but looks like <code>closest()</code> cannot find it because it's always passing an undefined element.</p>
<pre><code>$(".ui-icon-triangle-1-e").click(function () {
GetRuleData($(this).closest("a.tariff-link"));
});
</code></pre>
<p>An example of HTML would be like this:</p>
<pre><code><h3 class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" role="tab" aria-expanded="false" tabindex="-1">
<span class="ui-icon ui-icon-triangle-1-e"></span>
<a id="41965" class="tariff-link" href="#" tabindex="-1">
</h3>
</code></pre>
| javascript jquery | [3, 5] |
3,710,033 | 3,710,034 | Loading JQuery with Javascript from footer | <p><strong>If you would like to get to the point, here is my question:</strong>
Is there any way to call a specific script to load first in javascript?</p>
<p><strong>For more detail, please read below:</strong></p>
<p>I have a javascript file that is loading from the bottom of my HTML <code><body></code>. Unfortunately, there is no JQuery in the head, so I have to add it through this javascript file.</p>
<p>What I need to do is add a JQuery lightbox plugin. </p>
<p>My problem is that when I load the page, sometimes JQuery isn't the first thing loaded. So I receive the error "jQuery is not defined". Which will then raise more errors for undefined methods from the plugin.</p>
<p>This doesn't happen all the time, only sometimes. Which makes me think it's a loading/order of operations issue.</p>
<p>Is there any way I can guarantee that my JQuery script is the first thing loaded?</p>
<p>Here is some of my javascript file.</p>
<pre><code>//Get head element
var head = document.getElementsByTagName("head")[0];
//Create and insert JQuery
var jquery = document.createElement('script');
jquery.type = 'text/javascript';
jquery.src = 'http://image.iloqal.com/lib/fe6b/m/1/jquery.1.7.2.js';
head.insertBefore(jquery,head.childNodes[4]);
function thescripts() {
var fancybox = document.createElement('script');
fancybox.type = 'text/javascript';
fancybox.src = 'http://image.iloqal.com/ilejquery.fancybox-1.3.4.pack.js';
head.appendChild(fancybox);
var thebody = document.getElementsByTagName('body')[0];
thebody.appendChild(thediv);
thediv.appendChild(theimg);
//Run fancybox
thebody.onload = function() {
$('#lightbox').ready(function() {
$("#lightbox").fancybox().trigger('click');
});
}
};
if(jquery.attachEvent){
jquery.attachEvent("onload",thescripts());
} else {
jquery.onload = thescripts();
}
</code></pre>
<p>Any help is appreciated!</p>
| javascript jquery | [3, 5] |
5,245,085 | 5,245,086 | How to format isoDateTime to dd/m/yyyy | <p>I have this time <code>"2012-03-23 00:00:00"</code>. How can I format it to <code>"dd/m/yyyy"</code>?</p>
| javascript jquery | [3, 5] |
517,789 | 517,790 | not called Looper.prepare() when running a Timer from CallBack | <p>I'm in this code I am cycling through an attaylist of objects and assigning each object a callback, yet when I get to using a CountDownTimer, it crashes with <strong>Can't create handler inside thread that has not called Looper.prepare()</strong></p>
<pre><code> for ( final ABoxActor a : actList )
{
ActorDamageListener adl = new ActorDamageListener(){
public void ActorDestroyCallback() {
Log.e("KILLED", a.getBitmapName() );
}
public void ActorDamageCallback(float damage) {
Log.e("DAMAGED "+String.valueOf(damage), a.getBitmapName() );
a.setSpriteCurrentFrame(10);
//// THROWS Can't create handler inside thread that has not called Looper.prepare()
CountDownTimer t = new CountDownTimer(500,500){
@Override
public void onFinish() {
a.setSpriteCurrentFrame(15);
}
@Override
public void onTick(long millisUntilFinished) {
}}.start();
/////////////////////////////////
}
};
a.setListener(adl);
}
</code></pre>
<p>Any ideas what would be the easiest way to fix that? Can I somehow add this "looper" to my callback definition?</p>
<p>Thanks!</p>
| java android | [1, 4] |
3,136,315 | 3,136,316 | UserControl not rendering children when added to a page using aspx tag | <p>I must be missing a trick here. I have an <code>.aspx</code> page (that uses a master page, if that matters) with the following code in it:</p>
<pre><code><me:ModuleContainer runat="server" ID="topmodules"></me:ModuleContainer>
</code></pre>
<p>Now for some reason, my UserControl for <code>ModuleContainer</code> is called, all the properties on the control are called correctly, however it seems it just doesn't fill the control with the children in the <code>.ascx</code> file. Whereever I try to access them in the code (tried on Load and PreRender), the values are always null.</p>
<p>But it works if I programatically add it with the <code>LoadControl</code> method (but not just by declaring a new instance of <code>ModuleContainer</code>.</p>
<p>Ideally I'd like to get it working when loaded in the page. What am I doing wrong?</p>
| c# asp.net | [0, 9] |
5,705,126 | 5,705,127 | how to make this code works if i used it inside update panel and some of the checkbox values will be disabled according to database field ..? | <p>This code works fine if i use this inside ssercontrol > panel and i have a checkboxes in table when no checkbox is checked its works fine .... but if i disabled and checked any of the textbox then this doesn't work .... in usercontrol why ? i didnt understand ..</p>
<pre><code><script type="text/javascript" language="javascript">
function checkboxChecked(){
var allInputs = document.getElementsByTagName("input");
for(var i=0; i<allInputs.length; i++) {
var chk = allInputs[i];
if(chk.type == "checkbox" && !chk.disabled && chk.checked) {
return true;
}
}
alert("OOps! You haven't selected all available checkboxes");
return false;
}
</script>
</code></pre>
| javascript asp.net | [3, 9] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.