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 |
---|---|---|---|---|---|
652,152 | 652,153 |
Jquery to drag items to table cells in google calendar like fashion
|
<p>In an attempt to create a calendarlike application sort of like this <a href="http://arshaw.com/fullcalendar/" rel="nofollow">http://arshaw.com/fullcalendar/</a> or maybe this <a href="http://thechriswalker.net/select-drag/" rel="nofollow">http://thechriswalker.net/select-drag/</a> and <a href="http://neb.net/playground/dragdrop/" rel="nofollow">http://neb.net/playground/dragdrop/</a></p>
<p>I was wondering what the simples approach to using JQuery is. It seems the pages I've found are sort of experimental (except the fullcalendar but the source code for that is 150 kb - ie not a good place to start)</p>
|
javascript jquery
|
[3, 5]
|
3,515,620 | 3,515,621 |
jquery: event for simulating live typing
|
<p><strong>Part 1:</strong><br>
Is there any event I can use to get a callback when the user 'change' the input field. My definition of change is to simulate the following effect. say, I want to update a label while the user typing in the input box. I tried jquery "change" event. It works, but doesn't have the live effect. Once the input field is updated, I have to click on somewhere in the screen to update the label.</p>
<p><strong>Part 2:</strong></p>
<p>well, if this is not a good idea, I may prevent the form being submitted on enter key. Not sure about a good way to do it either. Quick search found this answer.</p>
<pre><code><form action="" method="post" onsubmit="return false;">
</code></pre>
<p>not tested yet, but hopefully the submit button may still works.</p>
<p>EDIT: tested, and onsubmit="return false;" prevents even the submit button.</p>
<p>thanks,<br>
bsr. </p>
|
javascript jquery
|
[3, 5]
|
4,722,592 | 4,722,593 |
Show/hide div based on checkbox value
|
<p>When the user checks 'student'(check-1). The 2 checkbox values are supposed to disappear and reveal a text input div. As of right now I've got the input-reveal down. But I can't seem to get the checkboxes to disappear. </p>
<p>I've tried: </p>
<pre><code>$(function () {
$('#check-1').change(function () {
$('.name').toggle(this.checked);
$('#check-1').hide();
$('#check-2').hide();
}).change();
});
</code></pre>
<p>But that doesn't work. How do I hide the checkboxes once 'student' is checked? Any idea's?</p>
<p>Here is a small <a href="http://jsfiddle.net/vkAy4/8/" rel="nofollow">fiddle</a> . Thanks for your help in advance.</p>
|
javascript jquery
|
[3, 5]
|
5,800,716 | 5,800,717 |
2 step problem: Share info between 2 user controls on a page, Display info in a scrolling list or gridview?
|
<p>I have a page with multiple user controls on it. In one user control, I have a set of checkboxes that set filters on what to display in a tree view, also in the same user control. In another user control, I have a list view (or gridview, haven't decided yet) That needs to display some information based on the filters that are defined, and the tree node selected in the previous user control.</p>
<p>The listview, or gridview, needs to scroll, displaying X(say 10) amount of records at a time. Depending on what the user has selected, there can be up to 28,000 records to display, so we only want to go to the database to get a small amount of records at a time, and update the list on the fly.</p>
|
c# asp.net
|
[0, 9]
|
4,626,483 | 4,626,484 |
summary of the gridview
|
<p>I need gridview summary on footer...</p>
<pre><code> protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
decimal totalPrice = 0M;
int totalItems = 0;
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label lblPrice = (Label)e.Row.FindControl("lblPrice");
decimal price = Decimal.Parse(lblPrice.Text);
totalPrice += price;
totalItems += 1;
}
if (e.Row.RowType == DataControlRowType.Footer)
{
Label lblTotalPrice = (Label)e.Row.FindControl("lblTotalPrice");
lblTotalPrice.Text = totalPrice.ToString();
}
}
</code></pre>
<p>But its not working. Any ideas?</p>
|
c# asp.net
|
[0, 9]
|
3,348,628 | 3,348,629 |
what does this code snippet mean
|
<p>code snippet:</p>
<pre><code> for( String token : tokens )
{
try
{
Url url = as("mycompany", "someapikey").call(shorten(token));
}
}
</code></pre>
<p>what do the 'as' and the 'call' mean. Are they keywords in java?</p>
<p>i was browsing and i found this code and i would like to understand what it means.</p>
<p>thank you in advance.</p>
|
java android
|
[1, 4]
|
4,299,776 | 4,299,777 |
byte array to a file
|
<p>I have a byte array for a file, is there a way to take that and save it has a file to a remote file server?</p>
<p>Thanks,
rod.</p>
|
c# asp.net
|
[0, 9]
|
4,388,524 | 4,388,525 |
Can I return an array of different objects from a method in C#
|
<p>Im creating my own "CMS" in asp.net, I get the page content from the database and then create custom image objects and html content.
For example, I have one method called GetPageInformation(string pageName) and it returns a Dictionary of name value pairs, but I want it to return 3 image objects, and 1 string text (with html markup)... is that possible? </p>
<p>Or how can convert this database string value into objects? </p>
<pre><code>(image path ; alt text ; link)
"~/img/home/homeimage.jpg;my alternate text;my href link"
field separator: ';'
registry separator: '|'
</code></pre>
<p>Then I fill one object, just for example:</p>
<pre><code>string[] images = myDBstring.Split('|');
PageImage.Path = images[0].Split(';')[0];
PageImage.AlternateText = images[0].Split(';')[1];
PageImage.LinkUrl = images[0].Split(';')[2];
//...
//PageImage derives from System.Web.UI.WebControls.Image
</code></pre>
<p>Sorry for my bad english... thanks!</p>
|
c# asp.net
|
[0, 9]
|
5,607,936 | 5,607,937 |
Hyperlink control not showing within ContentTemplate in ASP.NET
|
<pre><code><ContentTemplate>
<div class="detail_purchase_button">
<a class="commandbutton" href='/Courses?RestoreFilters=1'>Return to Catalog</a>
&nbsp;&nbsp;
<%# linkAddToCart %>
</div>
</ContentTemplate>
string url = "/Cart?AddItem={0}", DataItemID;
linkAddToCart = new HyperLink();
linkAddToCart.CssClass = "commandbutton";
linkAddToCart.NavigateUrl = url;
linkAddToCart.Text = "Add To Cart";
</code></pre>
<p>The button within the anchor tag shows up on the page. However, the Hyperlink button does not appear at all.
The second block of code is running in the Page_Load event (I will put it in a method after I get it to work) and is referencing a public Hyperlink field.</p>
<p>Thanks for any help.</p>
|
c# asp.net
|
[0, 9]
|
2,011,229 | 2,011,230 |
Execute a function at the end of the last effect of a Jquery.queue
|
<p> I would like to use fx and functions
I have a animation, and i would like to, at the end of the queue, do an ajax call. <br/>
I can't seem to make it work... <br/>
I have absolutely no idea how to procede... </p>
<p>that would a very very rough example, but</p>
<pre><code>$('#dvHeader').queue(function() {
$('#dvLeftContent').slideDown(2000);
$('#dvRightContent').animate({ backgroundColor: '#c71717' }, 2500)
callAjax();
}
</code></pre>
<p> This code calls the callAjax function way before the last effect starts, in fact, almost as the first one is called.<br/>
<i> The real case is a little more complex, i cannot use a callback of the animate effect, per example. I would like to know when the queue ends the last effect, or something like it.</i><br/>
How could I make that call to be triggered at the end of the last animation?</p>
|
javascript jquery
|
[3, 5]
|
3,866,506 | 3,866,507 |
How to disable back,forward and Refresh functionality in browser?
|
<p>Hi Can any one help to disable browser back,forward and back button and right Click Menu functionality using javascript or Jquery?I have tried disabling the back button like this</p>
function disableBackButton() {
window.history.forward();
}
setTimeout("disableBackButton()", 0);
<p>I have called this function in the Body onload event.I have a doubt that where we need to put this code in the Calling page or Called Page.Suppose i have two pages like this FirstPage.aspx and SecondPage.aspx.When i navigate from the First Page to Second Page when i click back button of the browser it should not go to FirstPage.aspx.</p>
<p>Please help me regarding this </p>
|
javascript jquery asp.net
|
[3, 5, 9]
|
2,822,167 | 2,822,168 |
jQuery grid for asp.net with dynamic columns
|
<p>There are lots of different jquery grid plugins available but I either can't seem to find or can't work out how to fill one dynamically. By this I mean to one grid I could be returning a dataset/json etc with 5 columns or one with just 2 and I want it to adjust accordingly. All the ones I find require you to specify the columns in some way before assigning data but I can't do this as the data returned to the grid is completely random (as its to be used as a data preview for the user when selecting tables/fields).</p>
<p>Does anyone know of one that can handle dynamic columns or of one I can use that I can easily modify them each time accordingly?</p>
|
jquery asp.net
|
[5, 9]
|
3,014,355 | 3,014,356 |
how do i retrieve the incoming phone call's number while ringing and store it in a variable in android?
|
<p>I am fairly new to and i would like my app to be able to retrieve the phone number of caller while ringing and store it how would i do this? </p>
|
java android
|
[1, 4]
|
526,257 | 526,258 |
Converting to Datetime issue
|
<p>I am trying to convert this content into DateTime.</p>
<pre><code> DateTime dtmNextPayment = Convert.ToDateTime(DateTime.Now.AddMonths(1).Month.ToString() + "/" + DateTime.Now.Day.ToString() + "/" + DateTime.Now.AddYears(1).Year.ToString());
</code></pre>
<p>Here, i get an exception "String was not recognized as a valid datetime". Where am i doing wrong?? Could some one help me. Thank you in advance..</p>
|
c# asp.net
|
[0, 9]
|
2,511,268 | 2,511,269 |
finding if the selected item is in a set
|
<p>I am using a bit of jquery and javascript mashed up in this weird hodgepodge of code.</p>
<pre><code>var SELECTED_ELEMENT; //this ends up being a JS array of ELEMENTS like the following line.
SELECTED_ELEMENT.push($(this).closest(".draggable"));
//Now i wanted to select stuff
$(".draggable").click(function(){
var found = 0;
for (var i = 0; i < SELECTED_ELEMENT.length; i++){
if(SELECTED_ELEMENT[i] == this){
found = 1;
}
}
if(found == 1){
alert("yep");
}else{
alert("nope");
}
});
//this doesnt seem to do what i want.
</code></pre>
<p>The question at hand is that this is never returning true, even when it is. I was just trying to find a way to in javascript search the array for it. You would think that a simple search through the array would figure it out, but possibly an improper reference to 'this'</p>
|
javascript jquery
|
[3, 5]
|
2,820,292 | 2,820,293 |
problem in if & else?
|
<p>why don't work <code>if(length_pa >= 16){ ...</code> after select value "2" in select box and don't work <code>if(length_pa == 0){...</code> after select value "all" in select box???<br>
[with change length(number) in <code>"var length_pa" $('#pagination a')</code> don't work "show" and "hide" for <code>#prev_pag, #next_pag</code>.] <p>
<strong>EXAMPLE:</strong> <a href="http://www.binboy.gigfa.com/admin/accommodation/show" rel="nofollow">See This</a></p>
<pre><code>var length_pa = $('.pagination a').size();
if(length_pa >= 16){
$('.prev_pag, .next_pag').show();
}else{
$('.prev_pag, .next_pag').hide();
$('.pagination').css('float','none')
}
if(length_pa == 0){
alert('0000000000')
$('.hesar_number').css('display','none');
}
</code></pre>
<p>what do i do?</p>
<p><strong>Explanation:</strong> <br>
If that value <code>2</code> be select, <code>.prev_pag, .next_pag</code> must show<br>
If that value 'all' be select, <code>.hesar_number</code> must hide(<code>'display','none'</code>)<br>
But these does not happen... why!?</p>
|
javascript jquery
|
[3, 5]
|
1,570,025 | 1,570,026 |
Using global resource in JavaScript
|
<p>I want to use global resource in my javascript code. Normally, when the code is inside the ASP code, I use
<code><%=GetGlobalResourceObject("Resource", "MONTHS_SHORT1") %></code>
and it works. But, when the javascript code is not inside the ASP code, for example in a folder as calendar.js, it does not work. How can I use the global resource in this case? Note: The resource file is inside my App_GlobalResources folder.</p>
|
javascript asp.net
|
[3, 9]
|
3,038,115 | 3,038,116 |
I am trying to implement a max count function within my 'click counter' android app
|
<p>So far I have the below java code. I am new to java. I would like to be able to have a max count of 500 after which the count returns to '0' and you can start counting again.</p>
<pre><code>import android.app.Activity;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.view.View.OnClickListener;
import android.widget.EditText;
public class wazeefa extends Activity
{
TextView txtCount;
Button btnCount;
int count = 0;
@Override
protected void onCreate(Bundle savedInstanceState)
{
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.wazeefa);
//button sound
final MediaPlayer mpButtonClick = MediaPlayer.create(this, R.raw.countbutton);
txtCount = (TextView)findViewById(R.id.wcount);
txtCount.setText(String.valueOf(count));
btnCount = (Button)findViewById(R.id.wclick);
btnCount.setOnClickListener(new OnClickListener()
{
public void onClick(View V)
{
count++;
txtCount.setText(String.valueOf(count));
mpButtonClick.start();
}
});
}
}
</code></pre>
|
java android
|
[1, 4]
|
4,343,618 | 4,343,619 |
selecting multiple days (10 days) in a calendar control in ASP.NET
|
<p>There is a calendar control in asp.net</p>
<p>For selection mode, there is day, dayweek and dayweekmonth.</p>
<p>But I wanna select randomly like every monday for the selected month.. something like that.</p>
<p>For that, I need to do the custom method.</p>
<p>Any idea?</p>
|
c# asp.net
|
[0, 9]
|
46,247 | 46,248 |
case/switch statement
|
<p>i need some help with switch/case statement syntax
im trying to use onClick to have different buttons do different things
i have the first one working
it just uses an intent to start a new activity.
for the next button, i want it to open a specific url
looks like this so far</p>
<pre><code>public void onClick(View v) {
switch (v.getId()) {
case R.id.about_button:
Intent i = new Intent(this, About.class);
startActivity(i);
case R.id.engadget_button:
Intent a = new Intent(this, )
</code></pre>
<p>how do i get the engadget_button to open engadget.com?</p>
<p>Is it just something like this:</p>
<pre><code>case R.id.engadget_button:
String url ="http://www.engadget.com/";
Intent a = new Intent(Intent.ACTION_VIEW);
a.setData(Uri.parse(url));
startActivity(a);
break;
</code></pre>
<p>??</p>
|
java android
|
[1, 4]
|
5,126,678 | 5,126,679 |
javascript doesn't correctly return from the loop
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1900172/jquery-each-method-does-not-return-value">jQuery each method does not return value</a> </p>
</blockquote>
<p>It seems the return statement does not break the loop and return the function. The following code keeps return false....</p>
<pre><code>var __in__ = function(elem, array){
// $.each(array, function(index, item) {
array.forEach(function(index, item) {
if (item == elem)
return true;
});
return false;
};
console.log(__in__(3,[1,2,3]));
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,259,621 | 4,259,622 |
JQXdropdown issue in php
|
<p>I am using jqxdropdownlist.js for dropdown in PHP. While onchanging I need to redirect respective pages. </p>
<p>The probem is for example in my dropdown i have the following values.</p>
<pre><code>$(document).ready(function () {
var source = [
"Affogato",
"Americano",
"Bicerin",
"Breve",
"Café Bombón",
"Café au lait",
"Caffé Corretto",
"Café Crema",
"Caffé Latte",
];
// Create a jqxDropDownList
$("#jqxdropdownlist").jqxDropDownList({ source: source, selectedIndex: 0, width: '200px', height: '25px' });
</code></pre>
<p>In that I want to choose "<strong>Café au lait</strong>" it should be in 2 in C series. While clicking C letter the drop down comes to 1st series of C that is <strong>Café Bombón</strong> after it will redirect to <strong>Café Bombón</strong> page. But I need to redirect to next series.</p>
<p>I am using the below code for Onchage function.</p>
<pre><code>$("#jqxWidget").change(function(){
var val1=$("#jqxWidget").jqxDropDownList('getItem', args.index);
window.location.href=val1.value;
});
</code></pre>
<p>Thanks in advance.</p>
|
php jquery
|
[2, 5]
|
5,386,924 | 5,386,925 |
Padding on Shape in Progressbar
|
<p>I'm using xml file to define progress bar.
I defined padding on background shape. But this setting will be sometimes displayed correctly, sometimes not.
So If I start my application or Activity with progressbar inside, there will be correctly displayed progressbar with background and 'padded' progress. Then I close my application and start it again, and, progressbar is displayed without padded background, on next start will be displayed correctly and son on ...
Could you please advice possible reasons for this?</p>
<p>xml file:
</p>
<pre><code><item android:id="@android:id/background" >
<shape>
<corners android:radius="15dip" />
<padding
android:left="1dp"
android:top="6dp"
android:right="1dp"
android:bottom="6dp"
/>
<solid
android:color="#00000000" />
</shape>
</item>
<item android:id="@android:id/progress" >
<clip android:clipOrientation="horizontal" android:gravity="left" >
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="15dip" />
<stroke
android:width="1px"
android:color="#ffffffff"
android:dashWidth="2px"
android:dashGap="0px"/>
<solid
android:color="#ff0000ff" />
</shape>
</clip>
</item>
</code></pre>
<p> </p>
|
java android
|
[1, 4]
|
3,535,596 | 3,535,597 |
add dynamically tab panel and add the image button or button on the dynamically added tab and show like the internet explore tab
|
<p>I want to add a tab dynamically and also add a button or image button in the added tab. But when i add a but on the added tab the button show below the tab header text. I want that The header text of dynamic added tab and button show in single line i.e align horizontal. The code is given below.
Please suggest me.</p>
<pre><code>UserControl uscont = (UserControl)this.LoadControl("JQGrid.ascx");
TabPanel t = new TabPanel();
Button btnclose2 = new Button();
btnclose2.Text = "Xjkjlk";
btnclose2.ID = "btn" + id;
btnclose2.Click += new EventHandler(btnclose_Click);
btnclose2.CausesValidation = false;
PlaceHolder ph = new PlaceHolder();
t.Controls.Add(ph);
ph.Controls.Add(btnclose2);
ph.Controls.Add(uscont);
t.HeaderText = mybtn.Text;
newTabCon.BorderStyle = BorderStyle.Solid;
newTabCon.Tabs.Add(t);
</code></pre>
|
c# asp.net
|
[0, 9]
|
4,992,638 | 4,992,639 |
How can I tell if a checkbox was actually clicked?
|
<p>I've got a binding for multiple inputs.</p>
<pre><code>$("#foo", "#bar", "#fooCheckbox", "#barCheckBox").bind("change", function() {
// do something here
// do something extra here if $(this) was actually clicked
});
</code></pre>
<p>Since there are other ways of initiating a change of an input, (jquery's .change() method for one), Is there a way to tell if a checkbox was actually clicked to cause the change event?</p>
<p>I tried focus however the focus event fires before a checkbox's change event so that doesn't work.</p>
<pre><code>$("#foo", "#bar", "#fooCheckbox", "#barCheckBox").bind("change", function() {
// do something here
if($(this).is(":focus")) // do something extra here but focus doesn't happen here for checkboxes.
});
</code></pre>
<p><strong>Edit #1</strong></p>
<p>Sorry I don't really know how to clarify this further...I don't care if the checkbox is checked or not...I know what .is(":checked") is and how to use it. It doesn't help here. I only want to know if the checkbox was actually clicked in to trigger the change event.</p>
<p><strong>Edit #2</strong></p>
<p>I have a work around...I first bind clicks for inputs and selects and store the id of the element. Then in my change binding I check to see if the element that changed is the same element that was last clicked.</p>
<pre><code>$("input, select").click(function() {
var myId = $(this).attr("id");
lastClickedStore.lastClicked = myId;
});
</code></pre>
<p>Then in the change binding I just check if the current ID equals the last clicked Id.</p>
<pre><code>$("#foo", "#bar", "#fooCheckbox", "#barCheckBox").bind("change", function() {
// do something
if(lastClickedStore.lastClicked == $(this).attr("id")) // do something else.
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,270,047 | 2,270,048 |
javascript for loop with decimals
|
<p>I'm trying to use this <code>for</code> loop in order to show divs. But I get a strange error from the jQuery lib.</p>
<p>Error: Syntax error, unrecognized expression: =10]</p>
<p>I have read about the problems with javascript decimals, but I still can't understand why this won't work:</p>
<pre><code>for (var i = 10.00; i >= ui.value; i -= 0.25) {
$("data_id=" + Math.floor(i) + "]").show();
}
</code></pre>
<p>When hiding the divs, I use this and it works fine:</p>
<pre><code>for (var i = 0.00; i < ui.value; i += 0.25) {
$("[data_id=" + Math.floor(i) + "]").hide();
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,910,761 | 3,910,762 |
How to cancel execution of all logic when user leaves a page?
|
<p>Not sure if this is possible, but when a user leaves a page to go to another page I want all server logic on the current page to end execution. I don't want a user to see an error that came from a page they were previously on (e.g. long running SQL query that times out). How would I do this?</p>
|
c# asp.net
|
[0, 9]
|
1,917,750 | 1,917,751 |
DatePicker Javascript
|
<p>I am in need of date picker javascript which allows date in mm/dd/yy format.</p>
<p>And also it should have good resolution and should be non-popup based.</p>
<p>I searched in google but not getting my exact requirements.</p>
<p>Plz suggest me the proper source.</p>
<p>Thank You.</p>
|
asp.net javascript
|
[9, 3]
|
4,769,578 | 4,769,579 |
JQuery Problem: $ not defined (I am trying to implement equal div heights script)
|
<p>I need a solution that will set the heights of two divs whose class = col to the height of the tallest one.</p>
<p>I found a solution here that I have used to implement this: <a href="http://www.cssnewbie.com/example/equal-heights/" rel="nofollow">http://www.cssnewbie.com/example/equal-heights/</a></p>
<p>This is the code that I have placed on my site:</p>
<pre><code><script language="javascript" type="text/javascript" href="jquery.js"></script>
<script>
function equalHeight(group) {
var tallest = 0;
group.each(function() {
var thisHeight = $(this).height();
if(thisHeight > tallest) {
tallest = thisHeight;
}
});
group.height(tallest);
}
$(document).ready(function() {
equalHeight($("div.col"));
});
</script>
</code></pre>
<p>Unfortunately, this does not solve my problem. When I open the Firefox Error Console, it says me "$ is not defined"</p>
<p>$(".col") should not be the problem right? When I run the command $$(".col") in Firebug Console it returns my two columns just fine.</p>
<p>Please help me with this, as it is driving me crazy! Thank you for your help. </p>
|
javascript jquery
|
[3, 5]
|
531,633 | 531,634 |
Drafts Feature Like Stackoverflow
|
<p>How to create a drafts like feature, which is simple and easy to use.
For example when we ask questions in <code>stackoverflow</code> it saves the question and when we open the page again it show the same content even after a system restart.</p>
<p>I have to options like to save data in cookies or in database. Which is more suitable for use and for slow internet connections.</p>
|
php jquery
|
[2, 5]
|
4,157,854 | 4,157,855 |
move to given div using jquery
|
<p>In my html i have got div with given class.</p>
<p>After clicking a button I would like to set the position to the top of that div. it may go the in smooth way .
How can I do that ?</p>
<p>thanks for help</p>
|
jquery asp.net
|
[5, 9]
|
48,579 | 48,580 |
jQuery update HTML on the fly
|
<p>I have a slideshow that has 5 slides (each has an individual id) and a previous and next button. When hovering the previous or next button you get a tooltip, the tooltip uses jQuery to get the ID attribute from the previous and next div and show this. </p>
<p>Ive gotten it working fine on mouseenter only if you dont leave the div and keep clicking the Tooltip doesnt update, you have to leave the arrows after each click for the value to be aupdated, does this make sense?</p>
<p>my script is...</p>
<pre><code> $("div.arrows div").bind("mouseenter", function () {
$("div.arrows div.next").children("span").html($("div.roundabout-in-focus").next("div").attr("id"));
$("div.arrows div.prev").children("span").html($("div.roundabout-in-focus").prev("div").attr("id"));
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,055,533 | 5,055,534 |
Jquery change onclick function name
|
<p>My question is! I am copying content from one table to another table and when I am doing this I need the function name to change to talentselect instead of driverselect which is attached to each table row. I still need to keep the variable values to parse. Just wondering if anyone can help me with this. I know that I should be binding the events to the elements with Jquery and not using OnClick but for now I need a solution to achieve this with the OnClicks.</p>
<p>Many Thanks!</p>
<p>The copying of the table</p>
<pre><code><table id="driverselectiontable" cellspacing="0">
<tr class="chosen" onclick="return driverselect(this, value, value);">
<td>driver</td></tr>
<tr class="odd" onclick="return driverselect(this, value, value);">
<td>driver</td></tr>
<tr class="even" onclick="return driverselect(this, value, value);">
<td>driver</td></tr>
<tr class="chosen" onclick="return driverselect(this, value, value);">
<td>driver</td></tr>
<tr class="even" onclick="return driverselect(this, value, value);">
<td>driver</td></tr>
</table>
<table id="talentselectiontable" cellspacing="0">
</table>
$("#talentselectiontable").html($("#driverselectiontable .chosen").clone(true).attr("class","odd"));
</code></pre>
<p>So basically I am copying all of the table rows that have the class named "chosen" but upon doing so I need to change the function call name to "talentselect". But each row in the table has different parameters being parsed which is allocated with PHP.</p>
<p>I have tried this piece of code but it is not working still</p>
<pre><code>$("#talentselectiontable tr").attr("onclick").replace("driverselect", "talentselect");
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,213,318 | 3,213,319 |
Global object of android app
|
<p>i am developing an android app.
I have some activities in it. And i must have an object which can be available from all activities.
Any ideas how to organize it?</p>
|
java android
|
[1, 4]
|
4,781,500 | 4,781,501 |
How to change jQuery default context?
|
<p>I loaded jQuery on a Firefox addon, which causes it to load using XUL's <code>window</code>.</p>
<p>I want to change the default context so it will use the correct <code>window</code> object.</p>
<p>The classic example I always see is:</p>
<pre><code>var $ = function(selector,context){
return new jQuery.fn.init(selector,context|| correctWindow );
};
$.fn = $.prototype = jQuery.fn;
</code></pre>
<p>But doing it I kill a lot of functions, like <code>.ajax</code>, <code>.browser</code>, ... I need these methods.</p>
<p><a href="https://addons.mozilla.org/en-US/firefox/" rel="nofollow">AMO</a> won't let me create an wrapper to <code>jQuery</code> to send the correct <code>window</code> object.</p>
<p>So my only option is to somehow change jQuery's default context without changing its source code.</p>
<p>What options do I have?</p>
|
javascript jquery
|
[3, 5]
|
3,040,320 | 3,040,321 |
How to avoid Logged User change after refreshing page?
|
<p>I am using FormsAuthentication.SetAuthCookie Method in my application.after Client login i am setting <strong>FormsAuthentication.SetAuthCookie(txtUserNo.Text.Trim(), false);</strong></p>
<p>and in web.config file i set </p>
<pre><code> <authentication mode="Forms">
<forms loginUrl="PasswordEntry.aspx" path="/" timeout="1"></forms>
</authentication>
</code></pre>
<p>after 1 minute (Page refreshing) i am getting Administrator data.its not right.Please tell me where the problem is ? and the solution also.</p>
<p>Thanks in advance.
Rakesh.</p>
|
c# asp.net
|
[0, 9]
|
5,064,414 | 5,064,415 |
how to use backbase in java application
|
<p>I am very very new to Backbase framework. I am planning to do POC for my new web application.
i am unable to get proper information. Please help me about backbase application.
and i need to how to declare events in back base.</p>
|
java javascript
|
[1, 3]
|
3,656,909 | 3,656,910 |
Display one list element at a time using jQuery; "Previous" link broken
|
<p>I am wanting to display one list element at a time. Ideally, the first list element would be showing when the user opens the page. When the user clicks the "next" button the first list element will disappear and the second one will appear. When the user clicks the "previous" button the previous element will be shown. So far, the next button works just fine but the previous button scrolls through the li elements but continues on to the link elements, which is not suppose to happen. Here is the code I am using.</p>
<p>HTML:</p>
<pre><code><div class="event_months">
<a class="prev" href="#">&#60;</a>
<a class="next" href="#">&#62;</a>
<li>one</li>
<li>two</li>
</div>
</code></pre>
<p>CSS:</p>
<pre><code>.event_months .noShow {
display:none;
}
.event_months .doShow {
display:inline;
}
.event_months .first {
display:inline !important;
}
</code></pre>
<p>jQuery:</p>
<pre><code><script type = "text/javascript" > $('document').ready(function() {
$(".event_months li:nth-child(3)").addClass("doShow");
$("a.next").click(function() {
$('.first').toggleClass("first");
var $toHighlight = $('.doShow').next().length > 0 ? $('.doShow').next() : $('.event_months li').first();
$('.doShow').removeClass('doShow');
$toHighlight.addClass('doShow');
});
$("a.prev").click(function() {
$('.first').toggleClass("first");
var $toHighlight = $('.doShow').prev().length > 0 ? $('.doShow').prev() : $('#event_months li').last();
$('.doShow').removeClass('doShow');
$toHighlight.addClass('doShow');
});
});
</script>
</code></pre>
|
javascript jquery
|
[3, 5]
|
619,589 | 619,590 |
Is there a way to make classes as stack variables in Java, or am I too much in the C++ mindset?
|
<p>I am somewhat familiar to Java, but am using it more now for Android.</p>
<p>Anyway, I'm kind of wondering if the only way to instantiate a class variable in Java is to allocate it onto the heap.</p>
<p>For instance: </p>
<pre><code>[C++ Land]
Foo foo;
foo.doSomeAwesomeStuff(9001);
[Java Land]
Foo foo = new Foo();
foo.doSomeAwesomeStuff(9001);
</code></pre>
<p>This kind of irks me because there are some things in Java where I just want a temporary variable like a placeholder Matrix, but I don't want to waste the system's heap by throwing garbage onto it.</p>
<p>I feel like this might be a call for the android-ndk then, but that feels too much like overkill.</p>
|
java android c++
|
[1, 4, 6]
|
1,375,131 | 1,375,132 |
How to use different pages for form input and results using AJAX
|
<p>So, I have a search form in a php page (top.php) which is an include for the site I'm working on, one php page where all the mySQL stuff happens and the results are stored in a variable and echoed (dosearch.php) and lastly a php page where the results are displayed in a div through jQuery (search.php). This is the javascript code: </p>
<pre><code>$(document).ready(function(){
$('#search_button').click(function(e) {
e.preventDefault();
var searchVal = $('#search_term').attr('value');
var categoryVal = $('#category').attr('value');
$.ajax({
type: 'POST',
url: 'dosearch.php',
data: "search_term=" + searchVal + "&category=" + categoryVal,
beforeSend: function() {
$('#results_cont').html('');
$('#loader').html('<img src="layout/ajax-loader.gif" alt="Searching..." />');
if(!searchVal[0]) {
$('#loader').html('');
$('#results_cont').html('No input...');
return false;
}
},
success: function(response) {
$('#loader').html('');
$('#results_cont').html(response);
}
});
});
});
</code></pre>
<p>The #search_term and #category fields are in top.php, the other divs (#loader and #results_cont) are in search.php. How would I go by in order to make the form submit and display the results in search.php from the top.php without problems? It works perfectly if the form and javascript are in search.php but I can't seem to separate those and make it work. What am I doing wrong?</p>
<p>PS. Sorry if I'm not clear enough, am at work, really tired. :(</p>
|
php javascript jquery
|
[2, 3, 5]
|
5,186,493 | 5,186,494 |
Converting CharSequence[] and CharSequence[]
|
<p>I always thought CharSequence[] and String[] were essential the same, however :</p>
<p>I have some code that has the following :</p>
<pre><code>CharSequence[] mEntries;
...
String[] mEntriesString = (String[]) mEntries;
ListAdapter adapter = new ArrayAdapter<String>(getContext(), R.layout.two_lines_list_preference_row, mEntriesString)
</code></pre>
<p>When the code runs I get </p>
<pre><code>java.lang.ClassCastException: java.lang.CharSequence[] cannot be cast to java.lang.String[]
</code></pre>
<p>So two questions ?</p>
<ul>
<li>why can this cast not happen</li>
<li>why does the ArrayAdapter not allow for a CharSequence[] in it's constructor.</li>
</ul>
|
java android
|
[1, 4]
|
3,371,369 | 3,371,370 |
How can jQuery seemingly be both an object and a method invoked by an object?
|
<p>There's a workaround function for an API object called <a href="http://wiki.greasespot.net/UnsafeWindow" rel="nofollow"><code>unsafeWindow</code></a> for browsers that don't support it (<a href="http://mths.be/unsafewindow" rel="nofollow">via this person's github</a>) </p>
<pre><code>var unsafeWindow = (function() {
var e1 = document.createElement('p')
e1.setAttribute('onclick', 'return window;');
return e1.onclick();
})();
// If the current document uses a JavaScript library, you can use it in
// your user script like this:
console.log(unsafeWindow.jQuery);
</code></pre>
<p>If <code>unsafeWindow</code> is an object (or in this case a function designed to mimic the object), how can it be used like <code>$ = unsafeWindow.jQuery</code>? I know this is how you map the function to the <code>$</code> instead of the <code>$</code> being a simple jQuery alias, but I'm just confused as to why, since I thought <code>jQuery</code> itself was an object, and is being invoked here like one would a method.</p>
<p><em>Edit: Thank you for your answers, I wish I could "check mark" all of you, thanks for the help!</em></p>
|
javascript jquery
|
[3, 5]
|
3,419,834 | 3,419,835 |
android: draw continuous string on multiple textview
|
<p>I need to create a multiple textview that holds a continuous string(like columns in newspaper and magazine)</p>
<p>is there anyway to make this possible?
any answers will be very helpful</p>
<p>thank you very much</p>
|
java android
|
[1, 4]
|
3,802,130 | 3,802,131 |
Jquery email validation
|
<p>After getting help from @juhana (thank you again) I ended up with theese codes to validate email input:</p>
<p>validate email:</p>
<pre><code>function validateEmail(){
var a = $("#email").val();
$.ajax({
type: "POST",
url: "check_email.php",
data: "email="+a,
success: function(rsp){
//if it's valid email
if(rsp == "ok"){
email.removeClass("error");
emailInfo.text("");
emailInfo.removeClass("error");
return true;
}
else
//if it exists
if(rsp == "exists" ){
email.addClass("error");
emailInfo.text("E-mail already in use");
emailInfo.addClass("error");
return false;
}
else
//if it's NOT valid
if(rsp == "invalid"){
email.addClass("error");
emailInfo.text("Please type a valid E-mail");
emailInfo.addClass("error");
return false;
}
}
});
}
</code></pre>
<p>check_email.php</p>
<pre><code><?php
require_once('db_conn.php');
require_once('is_email.php');
$email = mysql_real_escape_string($_POST['email']);
if (is_email($_POST['email'])){
echo 'ok';
$checkemail = mysql_query("SELECT E_mail FROM orders WHERE E_mail='$email'");
$email_exist = mysql_num_rows($checkemail);
if($email_exist>0){
echo 'exists';
}
}else{
echo 'invalid';
}
?>
</code></pre>
<p>Now 2 out of 3 are working the "ok" and the "invalid" ones... the "exists" doesn't.</p>
<p>What's wrong here???</p>
<p>Thank you</p>
|
php jquery
|
[2, 5]
|
3,112,703 | 3,112,704 |
Find in URL string from Array of values?
|
<p>I am trying to find array values in URL string? check the condition If requested URL contains array values then pass condition otherwise redirect to google.com </p>
<p>example</p>
<pre><code> $(document).ready(function () {
var urls = ["/dept/ce/",
"/dept/cs",
"/dept/career",
"/dept/it",
"/dept/mkt/",
"/dept/Membership/"
, "/dept/pr"
, "/dept/PS"
, "/dept/ta"
, "/dept/wc"
, "/dept/PubsProducts"
, "_layouts/settings.aspx"
,"/_catalogs/masterpage/"];
//If document.location.href = "http://localhost/dept/ce/default.aspx"
//And Array has "/dept/ce" values
//Now check document.location.href against array values, if
//document.location.href contains array values then pass condition otherwise
//else condition
});
</code></pre>
<p>How to do this?</p>
|
javascript jquery
|
[3, 5]
|
4,915,016 | 4,915,017 |
jQuery - "$ symbol is undefined"
|
<p>I was successfully using some plugin for about 6 months on my website and all of a sudden I started getting this message for one of my scripts: "$ is undefined".</p>
<p>This is the problematic line of code: <code>$.widget("ui.ImageColorPicker", uiImageColorPicker);</code></p>
<p>I'm using this plugin and almost the newest jQuery with noConflict enabled: <a href="http://github.com/Skarabaeus/ImageColorPicker" rel="nofollow">http://github.com/Skarabaeus/ImageColorPicker</a> I didn't change anything for 6 months (I didn't update jQuery). I'm sure it worked fine just 2 weeks ago and now it's broken all of a sudden.</p>
<p>EDIT: Error is gone. I'm removing example website.</p>
|
javascript jquery
|
[3, 5]
|
1,970,609 | 1,970,610 |
If element contains certain text
|
<pre><code>$('.test').css('background','red');
<div id="example">Some text</div>
</code></pre>
<p>How can I <code>.addClass('test')</code> if <code>#example</code> contains the word "text"?</p>
|
javascript jquery
|
[3, 5]
|
3,951,378 | 3,951,379 |
How do I insert text into a textbox after popping up another window to request information?
|
<p>I have an asp.net web page written in C#. Using some javascript I popup another .aspx page which has a few controls that are filled in and from which I create a small snippet of text. When the user clicks OK on that dialog box I want to insert that piece of text into a textbox on the page that initial "popped up" the dialog/popup page. I'm guessing that this will involve javascript which is not a strong point of mine.</p>
<p>How do I do this?</p>
|
c# asp.net javascript
|
[0, 9, 3]
|
291,837 | 291,838 |
How detect any of all events using jquery?
|
<p>I have function to detect idle state of user. I want to update database if any of the event occurs.Now i have script like this</p>
<pre><code>$("body").mousemove(function(event) {
myfuction();
});
</code></pre>
<p>I want to convert above script like this</p>
<pre><code>$("body").anyOfTheEvent(function(event) {
myfuction();
});
</code></pre>
<p>How can i do this?</p>
|
javascript jquery
|
[3, 5]
|
4,625,736 | 4,625,737 |
Open main-activity one time
|
<p>For my news-reader app, I made a widget. Using the widget it is possible to start the news-app. But if the user goes back to the home screen, with the back button, there still is an instance of the application. So if the user goes the applications-list (all the app's) and start the news-app again. There are 2 instances of the news app :S For closing the app, the users needs to push 2 times on the back button (because you see 2 times the same app). Can I do anything about it?</p>
<p>Here my code:</p>
<pre><code>static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
int appWidgetId) {
Intent configIntent = new Intent(context, Main.class);
PendingIntent configPendingIntent = PendingIntent.getActivity(context, 0, configIntent, 0);
RemoteViews remoteViews = new RemoteViews(context.getPackageName(), R.layout.widget);
remoteViews.setOnClickPendingIntent(R.id.headlinesBox, configPendingIntent);
// Tell the widget manager
appWidgetManager.updateAppWidget(appWidgetId, remoteViews);
</code></pre>
<p>}</p>
|
java android
|
[1, 4]
|
2,971,830 | 2,971,831 |
Using javascript history.back() fails in Safari .. how do I make it cross-browser?
|
<p>I am using </p>
<pre><code><a href="index.php" onclick="history.back();return false;">Back</a>
</code></pre>
<p>to provide a back to previous page link. It works fine on Windows (IE/Mozilla) but fails in Safari on both Windows/Mac.</p>
<p>Is there a way to make it work on all of the systems/browsers (cross-browser/platform)?</p>
<p>If it's not possible, is there any other way using PHP etc?</p>
|
php javascript
|
[2, 3]
|
4,856,636 | 4,856,637 |
Using jquery and javascript in Wordpress
|
<p>After trying for many many days without any improvement, I think I have no other choice but to ask for your help.
I have to admit that I don't know much about coding, but I've tried various tutorials, but just can't get to work what I want.</p>
<p>The problem is that I want sidebar tabs using jquery tools as well as creating my own slider (no image slider, but a content slider).
Although I did just as the tutorials say, the text just is displayed normally.
No effect, no slide, no tabs, nothing.</p>
<p>I uploaded the .js files, put the "script" info into the header.php, used the specific style.css, also put that into the header.php and then I tried to put some "divs" to create some content.
For the tabs I used <a href="http://www.elmastudio.de/webdesign/javascript-tab-menus-coole-effekte-fur-deine-sidebar/" rel="nofollow">this tutorial</a>. It's in German, but you can clearly see the steps where it tells you what to paste where. Is there anything missing? I put the "divs" into my home.php. Was that the mistake?</p>
<p>Do I have to put anything in my function.php as well?</p>
<p>I'm missing something, I'm sure of it, but I don't know what it is.
I really hope that somebody can help me out here and give me a short "step-by-step" instruction or something.</p>
<p><a href="http://www.zoomingjapan.com" rel="nofollow">My website</a> for reference.</p>
<p>Sorry for asking a stupid question, but I can't seem to sovle this by myself.</p>
<p>Thanks a lot :)</p>
|
jquery javascript
|
[5, 3]
|
4,161,808 | 4,161,809 |
Find hyperlinked text and URL
|
<p>I have a large text in that some word is hyperlinked, I want to know all that text and it's hyperlink url suppose my text is as per below:</p>
<p><em><a href="http://test.com" rel="nofollow">LoremIpsum.Net</a> is a small and simple static site that provides you with a decent sized passage without having to use a <a href="http://test34434.com" rel="nofollow">generator</a>. The site also provides an all caps version of the text, as well as translations, and an explanation of what this famous.</em></p>
<p>Now I want to store that hyperlinked word and it's url in array or hash table, can any one suggest me or provide me some sample code to do this.</p>
<p>Thanks in advance.</p>
|
c# asp.net
|
[0, 9]
|
2,372,805 | 2,372,806 |
how to use WinJS.Navigation.navigate
|
<p>I'm sorry if my question may appear stupid, but I want to ask if someone know how to use WinJS.Navigation.navigate() option.</p>
<p>I'm trying to utilize it in my code but the page is not being redirected. I can't understand what is the matter.</p>
<pre><code>WL.Event.subscribe("auth.sessionChange",
function (e) {
if (e.session) {
displayMe();
authLogin();
}
else {
clearMe();
}
}
);
function authLogin(e) {
if (e.status == 'connected') {
WL.Event.unsubscribe("auth.login", authLogin);
WinJS.Navigation.navigate('files.html');
}
}
WL.init({ client_id: cl_id, redirect_uri: red_uri, response_type: "code" });
</code></pre>
<p>I've tried to check if <code>e.status</code> is really <code>connected</code> and it's really true because when I refresh page manually the page is being populated by the return of api. </p>
<p>the problem is in navigation page. I tried to bruteforce it by adding <code>location.reload</code> but it also doesn't work;</p>
<pre><code>function authLogin(e) {
if (e.status == 'connected') {
WL.Event.unsubscribe("auth.login", authLogin);
WinJS.Navigation.navigate('files.html');
location.reload();
}
</code></pre>
<p>Can anybody give me a hint on what am I doing wrong? because i am at a loss.</p>
|
javascript asp.net
|
[3, 9]
|
3,313,969 | 3,313,970 |
Why is the jQuery.attr() method not working inside my 'click' event?
|
<p>I have the following prototype code to trigger a process when a button is clicked:</p>
<pre><code>jQuery("#queue-process").click(function() {
jQuery("#queue-process").attr("disabled", "disabled");
try {
processQueue();
} catch (e) {
console.log(e.message);
} finally {
jQuery("#queue-process").removeAttr("disabled");
}
});
</code></pre>
<p>The <code>processQueue</code> function is always called, but the <code>attr("disabled", "disabled")</code> is called only when I debug the anonymous function in the Chrome JavaScript console, i.e. if I place a breakpoint on that line, and single-step over it, it works, but outside of the debugger only <code>processQueue()</code> executes.</p>
<p>Why could this be happening?</p>
|
javascript jquery
|
[3, 5]
|
1,315,021 | 1,315,022 |
Cannot Parse Variables from RowEditing to RowUpdating
|
<p>I am having trouble getting the values of public variables <strong>file</strong> and <strong>desc</strong> set on the <strong>RowEditing</strong> method.</p>
<p>I have put a break-point at the end of the <strong>RowEditing</strong> and i can see that the <strong>file</strong> and <strong>desc</strong> values are being set, but when i click on <strong>Update</strong> these values on RowUpdating are being set back to <strong>""</strong>.</p>
<p>The gridDok.Rows[e.RowIndex].Cells[4].Text is also being set to <strong>""</strong> and i get the <strong>ArgumentExceprion</strong>:</p>
<p><strong>String cannot be of zero length.
Parameter name: oldValue</strong></p>
<p>Does anyone have a suggestion?</p>
<p>Here is the code of the methods:</p>
<pre><code>protected void gridDok_RowEditing(object sender, GridViewEditEventArgs e)
{
file = gridDok.Rows[e.NewEditIndex].Cells[5].Text;
desc = gridDok.Rows[e.NewEditIndex].Cells[4].Text;
}
protected void gridDok_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string file1 = file.Replace(desc, gridDok.Rows[e.RowIndex].Cells[4].Text);
File.Move("~/" + file, "~/" + file1);
}
</code></pre>
<p>Thanks in advance.</p>
|
c# asp.net
|
[0, 9]
|
1,526,737 | 1,526,738 |
How to get the number of lines in a textarea?
|
<p>What I would like is to count the number of lines in a textarea, e.g:</p>
<pre><code>line 1
line 2
line 3
line 4
</code></pre>
<p>should count up to 4 lines. Basically pressing enter once would transfer you to the next line</p>
<p>The following code isn't working:</p>
<pre><code>var text = $("#myTextArea").val();
var lines = text.split("\r");
var count = lines.length;
console.log(count);
</code></pre>
<p>It always gives '1' no matter how many lines.</p>
|
javascript jquery
|
[3, 5]
|
1,427,363 | 1,427,364 |
Proper way to get a Recurring Callback on the UI thread
|
<p>I would like to get a recurring call back to invalidate a view. I am sure there is a neat way to do this. I am currently doing this and would like a neater / better solution if possible?</p>
<pre><code>new Thread()
{
@Override
public void run()
{
while (!Thread.currentThread().isInterrupted())
{
handler.post(new Runnable()
{
public void run()
{
BannerButton.this.invalidate();
}
});
try
{
Thread.sleep(50); // yields 20 fps
} catch (InterruptedException e)
{
Thread.currentThread().interrupt();
}
}
}
}.start();
</code></pre>
<p>For a single shot timer on the UI thread, I do this: (But I cant find a way to do this with repeats)</p>
<pre><code>(new Handler()).postDelayed(new Runnable()
{
@Override
public void run()
{
// Do stuff
}
}, SPLASH_SHOW_TIME);
</code></pre>
<p><a href="http://developer.android.com/reference/java/util/Timer.html" rel="nofollow">Timer</a> looked good, but it calls on a background thread. </p>
<p>Thanks.</p>
|
java android
|
[1, 4]
|
5,113,209 | 5,113,210 |
why "setContentView" can't work in " if " ??? thx
|
<p>when I was first start this app! I need a first screen in first time</p>
<pre><code> final String PREFS_NAME = "MyPrefsFile";//
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0);//
if (settings.getBoolean("my_first_time", true)) {//
//the app is being launched for first time, do something
Log.d("Comments1", "First time");
setContentView(R.layout.manual);// can not work
// record the fact that the app has been started at least once
settings.edit().putBoolean("my_first_time", false).commit();
}
</code></pre>
<p>the code is in onCreat! when "setContentView(R.layout.manual);" is outside the "if" . that can work! by the way! Log.d("Comments1", "First time"); always can work!</p>
|
java android
|
[1, 4]
|
2,742,029 | 2,742,030 |
Passing variables to a PHP file through jQuery
|
<p>Really not familiar with jQuery. Is there anyway I can pass form data to a PHP file using jQuery?</p>
<p>FORM:</p>
<pre><code><div id="dialog-form" title="Fill in your details!">
<form>
<fieldset>
<label for="name">Name</label>
<input type="text" name="name" id="name"/>
<label for="email">Email</label>
<input type="text" name="email" id="email" value=""/>
<label for="phone">Phone</label>
<input type="phone" name="phone" id="phone" value=""/>
</fieldset>
</form>
</code></pre>
<p></p>
<p>It's a pop-up dialog with jQuery and gets submitted with:</p>
<pre><code>$("#dialog-form").dialog({
autoOpen: false,
height: 450,
width: 350,
modal: true,
buttons: {
"Sumbit": function() {
//VALIDATES FORM INFO, IF CORRECT
if (Valid) {
$.ajax({
url: 'process-form.php',
success: function (response) {
//response is value returned from php
$("#dialog-success").dialog({
modal: true,
buttons: {
Ok: function() {
$(this).dialog("close");
}
}
});
}
});
$(this).dialog("close");
}
}
}
});
</code></pre>
<p>What I want to do is to send the form data that the user enters into <code>process-form.php</code>, where it will be processed and sent as an email (which I can do). Just not to sure on the jQuery side of things. Is it even possible?</p>
|
php jquery
|
[2, 5]
|
5,686,573 | 5,686,574 |
Why is Javascript used in MongoDB and CouchDB instead of other languages such as Java, C++?
|
<p>I asked this question on SO but was suggested to try here. So here it goes:</p>
<p>My understanding of Javascript so far has been that it is a client-side language that capture events and makes a web-page dynamic.</p>
<p>But on reading the <a href="http://www.mongodb.org/display/DOCS/Comparing+Mongo+DB+and+Couch+DB">comparison between MongoDB and CouchDB</a> I noticed that both are using Javascript. This makes me wonder the reason behind the choice of JavaScript over other conventional languages.</p>
<p>I guess I am trying to understand the role of JavaScript and its advantages over other languages.</p>
<p>Update: I am not asking about the languages / drivers supported by the two databases. The comparison says: </p>
<blockquote>
<p>Both CouchDB and MongoDB make use of Javascript. CouchDB uses Javascript extensively including in the building of <a href="http://wiki.apache.org/couchdb/Introduction_to_CouchDB_views">views</a>.</p>
<p>MongoDB also supports running arbitrary javascript functions server-side and uses javascript for map/reduce operations.</p>
</blockquote>
<p>My lack of understanding pertains to why is Javascript being used at all for the backend work. Why is it preferred for building views in CouchDB, or for using map/reduce operations? Why C/C++ or Java were not used? What are the advantages in using Javascript for such back-end work?</p>
|
java javascript
|
[1, 3]
|
1,875,929 | 1,875,930 |
capturing f5 keypress event in javascript using window.event.keyCode in window.onbeforeunload event is always 0 and not 116
|
<p>i am creating an MVC application.There was a neccessitity to make a variable in a session to null upon closing of the application (i.e. window/tab) but not upon refreshing the application.
I tried it through the following code.</p>
<pre><code><script type="text/javascript">
window.onbeforeunload = function (e) {
e = e || window.event;
if (window.event.keyCode == 116) {
alert("f5 pressed");
}
else {
alert("Window closed");
//call my c# code to make my variable null, eg:Session["myVariable"] = null;
}
};
</script>
</code></pre>
<p>But when F5 is pressed then, "window.event.keyCode" is always 0 and not 116.
Because of which my variable is becoming null even upon F5 key press which is not my requirement.</p>
<p>Even when the application (i.e. webpage) is closed,even then its 0 (which is probably correct).</p>
<p>Please note that the above part of the code is in .cshtml file.</p>
<p>Can anyone tell where am i wrong ?</p>
|
javascript jquery
|
[3, 5]
|
4,059,957 | 4,059,958 |
Image Map with Icons Placed in Hotspots
|
<p>So, my project, in a nutshell, allows users to view an ImageMap with predefined hotspots that represent the locations of printers around the office. When they hover over these hotspots, I will add a tooltip telling them the name of the printer and give them the ability to install the printer drivers remotely. </p>
<p>My question would be: is it possible to add an icon (such as a small printer that would be the same for each hotspot) in the locations of the hotspots using jquery or some other method? I'm aware that you can't add a CssClass to hotspots (which is kind of a bummer), but is there a way to force this, or use a plugin like ImageMapster to make it so that the icons are constantly there in order to signify where the printers are?</p>
<p>Any ideas or help would be appreciated!</p>
|
c# javascript jquery asp.net
|
[0, 3, 5, 9]
|
3,869,024 | 3,869,025 |
jQuery - programming style - many bindings vs. conditional single one
|
<p>I frequently see code like that:</p>
<pre><code>$("#foo").live("mouseover mouseout", function(e) {
if (e.type == "mouseover") {
$("#foo").append("<div id='bar'>");
} else {
$("#bar").remove();
}
});
</code></pre>
<p>instead of more self-explanatory in my opinion:</p>
<pre><code>$("#foo").live("mouseover", function(e) {
$("#foo").append("<div id='bar'>");
})
.live("mouseout", function(e) {
$("#bar").remove();
});
</code></pre>
<p>the same goes with</p>
<pre><code>$('#contentPageID, #itemURL').change ( function () {
if ( $(this).is('#contentPageID') )
...
else
...
});
</code></pre>
<p>does it have any purpose or is it just different coding style (counter intuitive in my point of view) ?</p>
|
javascript jquery
|
[3, 5]
|
800,868 | 800,869 |
How to get the network uri of a file being downloaded from the Download Manager in Android
|
<p>I am writing an application wherein I want to detect if a download has started and retrieve the URI of the file being downloaded and then cancel the download from the Download Manager. I am doing this so that I can send this URI somewhere else.</p>
<p>The trouble is that I can detect when a download begins by querying the Download Manager, but is there a method or a constant variable in Download Manager from which I can also get the URL of the file being downloaded</p>
|
java android
|
[1, 4]
|
4,019,045 | 4,019,046 |
Pass a query in URL using jquery
|
<p>I want to pass a $_GET[''] to a php file, when a word is clicked in a div,it must display data from the db.</p>
<p> It displays the data without the query.</p>
<p>The process.php contains SQL statement to query the db and display values.</p>
<p>Thanks
Jean</p>
|
php jquery
|
[2, 5]
|
5,447,030 | 5,447,031 |
How work the jquery oriented object?
|
<p>I don't understand how work an object with Jquery/javascript.</p>
<p>And how create a private method/variable with? i see on the forum a closure but i have try and not work. And how see if the method/variable is private? because when I run the website, I see always the function and variable with the own value into my script...</p>
<p>Thanks for your help :).</p>
<p>By e.x:</p>
<pre><code>var ClassName=function()
{
validation : 0,
name : 0,
privateVar: 0,
init : function ()
{
validation = 1;
name ="toto";
}
privatefunction :function()
{
alert("a private function");
}
};
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,359,045 | 3,359,046 |
How to return multiple values from java method to java script?
|
<p>I want to return two values from java method to java script..can you help me.??
would be grateful for help..</p>
|
java javascript
|
[1, 3]
|
3,482,304 | 3,482,305 |
Python Script Failing to Execute from PHP exec()
|
<p>I have a simple PHP function that is supposed to execute a Pyton script when its called. I have tried this sort of function multiple times in my php programs, but somehow this time this function is not executing the python script at all. When I access the script from the command prompt and run <code>python testing.py</code> then it successfully gets executed. One thing that I want to mention that this script has some serious implementations of python's NLTK library, and takes more than 20 seconds to execute and perform its operations (i.e. data process and storing to db). Is this delay in the execution which is causing this problem or is there something else that I am missing this time? </p>
<pre><code>function success(){
$mystring = exec('python testing.py');
$mystring;
if(!$mystring){
echo "python exec failed";
}
else{
echo "<br />";
echo "successfully executed!";
}
</code></pre>
|
php python
|
[2, 7]
|
3,251,211 | 3,251,212 |
jQuery Galleria plug-in: Make auto-play?
|
<p>I am using this <a href="http://kranichs.com/johncarder/gallery2" rel="nofollow">jQuery plugin</a></p>
<p>It is very nice, but I can't seem to figure out how to get it to auto-play. (automatically transition to the next image at an interval)</p>
<p>Has anyone else gotten this to do that?</p>
|
javascript jquery
|
[3, 5]
|
2,272,802 | 2,272,803 |
Equivalent of set= and getActionCommand in Android Java?
|
<p>I've just started learning Android development and as a little project, I'm building a calculator. The way it works is that when a number button is pressed, the number is appended to the EditText. I don't want to write this code for each of the buttons, because it's tedious and blatantly inefficient but i'm not sure how to go about it. </p>
<p>When I programmed in Java, I got around the problem by setting the ActionCommand of the JButton equal to the number and then making a general </p>
<pre><code>textField.append(button.getActionCommand());
</code></pre>
<p>Is this possible in Android? Is there a better approach?
Thanks for your help!</p>
|
java android
|
[1, 4]
|
6,031,205 | 6,031,206 |
JQuery table w/ sorting
|
<p>There are all kinds of JQuery widgets that offer some nice features like sorting by a columns (like <a href="http://tablesorter.com/docs/" rel="nofollow">http://tablesorter.com/docs/</a> or <a href="http://www.datatables.net/" rel="nofollow">http://www.datatables.net/</a>)</p>
<p>I haven't found one that integrates with server side sorting though. I have the following requirements:</p>
<ol>
<li>sort by clicked column (server side sort)</li>
<li>filter by a text field over each column</li>
<li>selectable which columns to display</li>
</ol>
<p>any suggestions on a widget that has some or all of these criteria?</p>
<p>thanks</p>
|
javascript jquery
|
[3, 5]
|
394,579 | 394,580 |
how to access javascript variable with php code
|
<pre><code> function al(){
var selr = jQuery('#grid').jqGrid('getGridParam','selrow');
if(selr){
<?
include_once("../../DB/singleton.php");
$pDatabase = Database::getInstance();
$c = $pDatabase->query("select c.city_title as 'City' from teamshuffle.tbl_city c, teamshuffle.tbl_sport_city s where c.tblcity_id = s.tblcity_id and s.tblsport_id = " . );
while($r = mysql_fetch_array($c)){
echo("alert(\"" . $r[0] . selr . "\");");
}
?>
}
}
</code></pre>
<p>This is my javascript function. I need to access variable "selr" in the line </p>
<pre><code>echo("alert(\"" . $r[0] . $d . "\");");
</code></pre>
|
php javascript
|
[2, 3]
|
5,076,897 | 5,076,898 |
Store additional info with button
|
<p>How can I attach additional information to a button programmatically? I can mButton.setText("new text") to change the text but I want to be able to add a few more fields so that when you click the button you can grab those extra fields and use the data. How might I do that?</p>
|
java android
|
[1, 4]
|
3,951,310 | 3,951,311 |
How to track down a page reload in javascript
|
<p>I am debugging a page that has a jquery dialog that contains a textbox and an ok button.</p>
<p>When a user hits enter, the page is reloading and the textbox ID & value are being passed to the page reload as get parameters. e.g. </p>
<pre><code>http://example.com?tex_box_id=text_entered_in_text_box
</code></pre>
<p>I cannot figure out what is causing this behavior and can't figure out how to best track it down since the page itself is reloading.</p>
<p>I have tried stepping through all the jquery code, but did not have any luck. I can only assume that somebody somewhere attached a key press listener, but I can't figure out who. I know I can work around this by preventing theirs from running, but I still really want to figure out why it is happening. </p>
<p>Note that this does NOT happen if you click the OK button, only if you hit enter when you are in the text box</p>
|
javascript jquery
|
[3, 5]
|
5,277,510 | 5,277,511 |
jquery this versus $(this) and maybe even $this
|
<p>I often see examples of using the keyword <code>this</code> in jquery. Sometimes I see it used with the $ and parenthesis, other times without. And I thought I saw it used with a little of each.</p>
<p>So,</p>
<pre><code> var id = this.attr('id');
var id = $(this).attr('id');
var id = $this.attr('id');
</code></pre>
<p>Are these all the same? Is there a preferred way? Is <code>this</code> a javascript thing and <code>$(this)</code> a jQuery thing? If so, where does <code>$this</code> fall?</p>
<p>I know this is probably a total newbie question, but I haven't been able to get the simple, <code>this</code>, by itself, to work. I can only get <code>$(this)</code> to work. I'm not sure if I'm doing something wrong, or if I've been reading examples with typos.</p>
|
javascript jquery
|
[3, 5]
|
5,009,093 | 5,009,094 |
How show the content of a div after the CSS inside is ready
|
<p>I have this Code:</p>
<pre><code>$.ajax({
type: 'GET',
url: 'url.php',
success: function(data){
$("div#mainclass").hide().html(data).fadeIn(100);
}
});
</code></pre>
<p>When the fadeIn triggers, I see for a very short time, the html flashing with no CSS-Style applied, before the CSS applies. This problem is only visible in Firefox, Chrome seems to be fast enough. How can I prevent the display, until the CSS is parsed and applied?
<br>
Of course, I already tried a few things, but no luck^^</p>
<pre><code>$("div#mainclass").hide().html(data).delay(200).fadeIn(100);
// With Delay -> Same problem
</code></pre>
<hr>
<pre><code>$("div#mainclass").hide().html(data).ready(function(){
$("div#mainclass").fadeIn(100)
};
// Also the ready Function doesn't help here.
</code></pre>
<p><hr>
Thanks a lot!</p>
|
javascript jquery
|
[3, 5]
|
1,064,649 | 1,064,650 |
Detect HTML in ASP.NET
|
<p>(clarification: this is an old question that has been tweaked for admin purposes)</p>
<p>There have been a fair amount of questions on this site about parsing HTML from textareas and whatnot, or not allowing HTML in Textboxes. My question is similar: How would I detect if HTML is present in the textbox? Would I need to run it through a regular expression of all known HTML tags? Is there a current library for .NET that has the ability to detect when HTML is inserted into a Textarea?</p>
<p>Edit: Similarly, is there a JavaScript Library that does this?</p>
<p>Edit #2: Due to the way that the web app works (It validates textarea text on asyncronous postback using the Validate method of ASP.NET), it bombs before it can get back to the code-behind to use HTML.Encode. My concern was trying to find another way of handling HTML in those instances.</p>
|
c# javascript asp.net
|
[0, 3, 9]
|
3,621,356 | 3,621,357 |
Creating an object array in jQuery
|
<p>I want to store an array of latitudes/longitudes. I have these inputs on my page:</p>
<pre><code><input type="hidden" class="latitude" value="-12.3456" />
<input type="hidden" class="longitude" value="12.3456" />
<input type="hidden" class="latitude" value="98.7654" />
<input type="hidden" class="longitude" value="-98.7654" />
</code></pre>
<p>And I'm putting them into arrays like so:</p>
<pre><code>var latitudes = $('.latitude').map(function () { return this.value; }).get();
var longitudes = $('.longitude').map(function () { return this.value; }).get();
</code></pre>
<p>But I'm thinking that it would be better to store them in a single array as objects, so that I can say:</p>
<pre><code>$.each(array, function (i, obj) {
alert(obj.Latitude);
alert(obj.Longitude);
});
</code></pre>
<p>How can I modify this to create an array of objects?</p>
|
javascript jquery
|
[3, 5]
|
3,369,329 | 3,369,330 |
need help getting contents from an EditText and placing it in my url
|
<p>I am working on an app where the user enters a url into the edit text field and my app takes him/her to that particular web page . </p>
<p>URL url = new URL("url_text.toString()");</p>
<p>i get an error as its not able to process the url .
what is the problem ?</p>
|
java android
|
[1, 4]
|
2,409,083 | 2,409,084 |
Default timezone for DateTime in asp.Net
|
<p>What determines the default timezone for a DateTime instance if no timezone is specified.
Example:
A user living in timezone A visits a webpage hosted on a server in timezone B:
If the website code calls ToUniversalTime() on a dateTime instance, will timezone A or timezone B be used as the bases for the calculation?</p>
<p>Thanks in advance </p>
|
c# asp.net
|
[0, 9]
|
3,083,628 | 3,083,629 |
Make div appear on dynamic option select
|
<p>I have a SELECT input that gets all of its options via the database. Below the select input, there are divs created for each option in the select. I want the user to select an option from the drop down and make the div below display. So basically the drop down are sports, and if they make a selection the sport div hidden below will load, and that div will contain all the sport positions</p>
<pre><code> <select name="sport" id="select">
<?
foreach ($getSports as $row) {
echo '<option onClick="toggle'.$row['1'].'()" onLoad="toggle'.$row['1'].'()" value="' . $row['0'] . '">' . $row['1'] . '</option>';
}
?>
</select>
</label>
<?
foreach ($getSports as $row) {
echo '<div id="position' . $row['1'].'" style="margin-top: 5px;display:none;">Positions:' . $row['1'].'';
$sport = $row['0'];
$getPositions = $model->getPositions($sport);
foreach ($getPositions as $row2) {
echo '<label style="float:right">'.$row2['1'].'</label>';
echo '<input type="checkbox" name="'.$row2['1'].'" value="'.$row2['0'].'">';
}
echo '</div>';
}
?>
</code></pre>
|
php javascript jquery
|
[2, 3, 5]
|
190,525 | 190,526 |
Role based security with asp.net
|
<p>How to implement role based security in each page.</p>
|
c# asp.net
|
[0, 9]
|
3,869,083 | 3,869,084 |
How to send two inputs with jQuery
|
<p>ok, i have these two input fields where a user puts in two twitter names. When the submit button is pressed, both names should be send to a .php file with the POST method that checks if both usernames exsist on twitter.</p>
<p>Sending and receiving the answer for one value already works, but how can i also add the second? I already have this:</p>
<pre><code><script type="text/javascript">
function checkUsername()
{
$.ajax({
type: 'POST',
url: 'tu.php',
**data: {'user1' : $('#user1').val() },** //how to append user2?
dataType: "json",
success: function(data){
$('#uitslag').html(JSON.stringify(data));
$('#user1text').html(data['user1']);
$('#user2text').html(data['user2']);
}
});
}
</script>
</code></pre>
<p>the fields in the form:</p>
<pre><code> <td><input type="text" name="user1" id="user1"/></td>
<td><input type="text" name="user2" id="user2" /></td>
</code></pre>
<p>and this is how the values should be able to be cathed in the .php:</p>
<pre><code>$user1 = $_POST['user1'];
$user2 = $_POST['user2'];
</code></pre>
<p>So the question really is: how can I append the second username to the above jQuery POST function?</p>
<p>p.s. I am starting with javascript and jQuery, how do you guys work with this as no error messages are shown ever.. is there an environment/programm where I get debugging help with javascript?</p>
|
php javascript jquery
|
[2, 3, 5]
|
6,028,703 | 6,028,704 |
Optimisation for reading contacts in listView?
|
<p>I have code to read contacts, get name and number and put them in listView. Everything works but application read all contacts in the same moment. I guess that I have to read them on scroll move, but I don't now how, please help?
Thank you in advance, Wolf.</p>
<p>Here is my code:</p>
<p>ArrayList> mapa = new ArrayList>();</p>
<pre><code> ContentResolver cr = getContentResolver();
Cursor cur = cr.query(ContactsContract.Contacts.CONTENT_URI, null, null, null, null);
if(cur.getCount() > 0){
while(cur.moveToNext()){
id = cur.getString(cur.getColumnIndex(ContactsContract.Contacts._ID));
if(Integer.parseInt(cur.getString(cur.getColumnIndex(ContactsContract.Contacts.HAS_PHONE_NUMBER))) > 0){
final Cursor numCur = cr.query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, null, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = ?", new String[]{id}, null);
for(numCur.moveToFirst(); !numCur.isAfterLast(); numCur.moveToNext()){
brTel = numCur.getString(numCur.getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
ime = cur.getString(cur.getColumnIndex(ContactsContract.Contacts.DISPLAY_NAME));
tmpIme = new String[] {ime};
for(int i = 0; i < tmpIme.length; i++){
HashMap<String, String> imeMapa = new HashMap<String, String>();
imeMapa.put("imeLista", ime);
imeMapa.put("Mobilni", brTel);
mapa.add(imeMapa);
}
}
numCur.close();
}
} // While
}
SimpleAdapter sa = new SimpleAdapter(getApplicationContext(), mapa, R.layout.imenik, new String[] {"imeLista", "Mobilni"}, new int[] {R.id.tvImeImenik, R.id.tvSamoProba});
lImenik.setAdapter(sa);
</code></pre>
|
java android
|
[1, 4]
|
5,815,755 | 5,815,756 |
Javascript - get text between <li> by ID
|
<p>I'm trying to write some javascript that will grab the inner text of li elements (1-16) and put them into hidden fields. </p>
<pre><code> var myValue9 = document.getElementById("fileName9").value;
oForm.elements["fileName9"].value = myValue9;
<input name="fileName9" type="hidden" id="fileName9" />
<li id="wavName9"> Some Text </li>
</code></pre>
<p>How do I return the text in between the <code><li></code> and put into the hidden field?</p>
|
javascript jquery
|
[3, 5]
|
4,387,214 | 4,387,215 |
How do I get some JavaScript/jQuery to run in sequence
|
<p>I have an HTML file which contains two divisions. One has id 'welcome' and the other is named 'welcome_distort'.</p>
<p>With jQuery imported, I have a seperate js file which contains some code that operates on these divs.</p>
<pre><code>$("#welcome").fadeTo(50,0.1);
$("#welcome").fadeTo(10,1.0);
$("#welcome").fadeTo(10,0.1);
$("#welcome").fadeTo(10,1.0);
$("#welcome").fadeTo(1000,0.0);
$("#welcome_distort").css({opacity:"1.0"});
</code></pre>
<p>All the fadeTo() commands work in sequence. What I then want to happen is the css() command to come after these fadeTo()s. In reality, the operation on welcome_distort takes place at the same time as the first operation on welcome. My question is: how do I get the .css() operation to run after the last .fadeTo().</p>
<p>Many Thanks,
John</p>
|
javascript jquery
|
[3, 5]
|
3,109,197 | 3,109,198 |
Execute a function with sliding delay
|
<p>Say I have an html page which diplays a list of some elements. There is a textbox which allows the user to filter the elements. To update the displayed elements, I need to do an ajax call to retrieve the elements that match the filter value. I want the ajax call to be executed two seconds after the last letter was typed in the filter textbox. I know about <code>settimeout</code> but I want the two second delay to be "sliding", meaning that if within the two second delay period the user types another letter, then I want to reset the delay. How would I go about that? </p>
<p>Thanks in advance.</p>
|
javascript jquery
|
[3, 5]
|
3,529,936 | 3,529,937 |
How to detect the clicked href URL in JQuery/Javascript
|
<p>Does anyone know how to detect the clicked href URL in JQuery? For example I have the following links, some is redirect to the new page and some will call to the javascript to expand the div. How can I use the JQuery/Javascript to detect the href if no ID been use.</p>
<pre><code><a href="www.test.com">Test 1</a>
<a href="javascript:test()">Test 2</a>
<a href="www.test2.com">Test 3</a>
<a href="www.test3.com">Test 4</a>
<a href="javascript:test2()">Test 5</a>
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,730,709 | 3,730,710 |
boost::python: compilation fails because copy constructor is private
|
<p>i use boost::python to wrap a C++ class. This class does not allow copy constructors, but the python module always wants to create one. </p>
<p>The C++ class looks like this (simplified)</p>
<pre><code>class Foo {
public:
Foo(const char *name); // constructor
private:
ByteArray m_bytearray;
};
</code></pre>
<p>The ByteArray class is inherited from boost::noncopyable, therefore Foo does not have copy constructors.</p>
<p>Here's the Python module stub:</p>
<pre><code>BOOST_PYTHON_MODULE(Foo)
{
class_<Foo>("Foo", init<const char *>())
;
}
</code></pre>
<p>When compiling the boost::python module, i get errors that a copy constructor for Foo cannot be created because ByteArray inherits from boost::noncopyable.</p>
<p>How can i disable copy constructors in my python module?</p>
<p>Thanks
Christoph</p>
|
c++ python
|
[6, 7]
|
112,116 | 112,117 |
use of Window Shell in programme
|
<p>Can someone tell me that if there is any harm (to OS(Win Xp) if i programme using window shell in ASP.NET.</p>
|
c# asp.net
|
[0, 9]
|
4,626,055 | 4,626,056 |
Is $(function() { }) an exact equivalent to $(document).ready(function() { })
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/2662778/what-is-the-difference-between-these-jquery-ready-functions">What is the difference between these jQuery ready functions?</a><br>
<a href="http://stackoverflow.com/questions/4384651/are-function-and-document-readyfunction-the-same">Are $(function(){}); and $(“document”).ready(function(){}); the same?</a><br>
<a href="http://stackoverflow.com/questions/12008843/start-javascript-code-with-function-etc">start javascript code with $(function, etc</a> </p>
</blockquote>
<p>Today, while reviewing some javascript code I found that some portions of code where written in a <code>$(function() { })</code> section, and other part of code where inside a <code>$(document).ready(function() { })</code> one. So my first reaction was: OK, What's the difference?</p>
<p>After a little of googling I found the next statement in the jQuery tutorial <a href="http://docs.jquery.com/Tutorials%3aGetting_Started_with_jQuery" rel="nofollow">Getting Started with jQuery</a>:</p>
<blockquote>
<p>The following is a shortcut for the $(document).ready(callback) notation:</p>
</blockquote>
<pre><code>$(function() {
// code to execute when the DOM is ready
});
</code></pre>
<p>Now, the question is: Is <code>$(function() { })</code> an exact equivalent to <code>$(document).ready(function() { })</code>?</p>
<p>(And also a "less-global" indirect question will be: Is safe for me to put all the code in just one of the two sections?)</p>
|
javascript jquery
|
[3, 5]
|
4,285,799 | 4,285,800 |
retrieve data from dynamic text boxes created with jquery
|
<p>I'm creating text boxes using jquery.I want after that to get the data from text boxes and insert the answers in my table. This is my code for creating the text boxes.</p>
<pre><code> $(document).ready(function () {
var counter = 2;
$("#addButton").click(function () {
if (counter > 10) {
alert("Only 10 textboxes allow");
return false;
}
var newTextBoxDiv = $(document.createElement('div'))
.attr("id", 'TextBoxDiv' + counter);
newTextBoxDiv.html('<label>Raspuns' + counter + ' : </label>' +
'<input type="text" name="textbox' + counter +
'" id="textbox' + counter + '" value="" >' );
newTextBoxDiv.appendTo("#TextBoxesGroup");
counter++;
});
$("#removeButton").click(function () {
if (counter == 1) {
alert("No more textbox to remove");
return false;
}
counter--;
$("#TextBoxDiv" + counter).remove();
});
});
</code></pre>
<p>How can I select the data from the textboxes? I'm using c# and it's a asp.net application</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
4,583,779 | 4,583,780 |
how to write this type of fraction value as shown below?
|
<p><img src="http://i.stack.imgur.com/ZaLxN.png" alt="enter image description here"></p>
<p>Hot to write this type of fraction Value in java or android code as shown above ? Any idea/suggestion will be appreciated.</p>
|
java android
|
[1, 4]
|
889,786 | 889,787 |
How to improve the security on a ASP.NET site?
|
<p>I have an ASP.NET site and some clients want a better layer of security for accessing it. The site today asks for a username and password, but a lot of clients want to restrict the access to some machines and I need to do this on my server side. So, I'm asking for some advice.</p>
<ol>
<li><p>Use a VPN to restrict the access? (With mobile devices will not work)</p></li>
<li><p>Is possible to check the mac address?</p></li>
<li><p>Is possible to use client certificate?</p></li>
</ol>
|
c# asp.net
|
[0, 9]
|
981,475 | 981,476 |
jQuery fn() isn't loading / working?
|
<p>There is one div which changes frequently it's innerHTML by ajax. Once the page loads, jQuery function() works but when innerHTML changes by ajax then some functionality doesn't work. I checked the code using firebug and try to explain it in short.** </p>
<p>I think DOM loads the js file only when the page loaded first time and if ajax modifies innerHTML then function is not invoked somehow.What you say? what could be solution according to you?
<strong><em>HTML page</em></strong></p>
<pre><code> <body>
<div class="_div_change"> dynamically class add by jQuery function()
here contenet is added by ajax functionality
</div>
<script type="text/javascript">
$(function(){
$('._div_change').addClass('.div_class');
});
</script>
</body>
Loading first time & class is added by fn() |only div innerHTML modified by ajax ***
|
<div class="_div_change div_class"> | <div class="_div_change">
innerHTML elements added successfully| innerHTML elements altered successfully
</div> | </div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,143,978 | 4,143,979 |
two check boxes and 1 text field jquery
|
<p>I have two checkboxes and one text field. I want to put some data into field when one check box is checked and put another data when other checkbox is checked and both these checkboxes shouldn't be checked at the same time. But when these checkboxes are not checked the text field should be empty. I have achieved all the functionality except emptying the field when both my checkboxes are unchecked with the following jquery code.</p>
<pre><code>jQuery(document).ready(function() {
jQuery('#a').click(function() {
if(jQuery('#a').is(":checked")) {
jQuery('#b').removeAttr('checked');
name = "hello World!";
jQuery('#c').val(name);
}
});
jQuery('#b').click(function() {
if(jQuery('#b').is(":checked")) {
jQuery('#a').removeAttr('checked');
name = "Not hello World!";
jQuery('#c').val(name);
}
});
jQuery('#a,#b').click(function(){
if(jQuery('#a,#b').not(":checked")){
name = "";
jQuery('#c').val(name);
}
});
});
</code></pre>
<p>Here is my html:</p>
<pre><code> <input type="textarea" id="c" />
<input type="checkbox" id="a" />
<input type="checkbox" id="b" />
</code></pre>
<p>Please tell me how can I empty the text field when both the checkboxes are not checked.</p>
<p>Also how can I get value of one text field and put it into another text field and what if the value of the first text field is some type of html or javascript code.</p>
<p>One thing more I also want that the value of my variable "name" should be php code. Please tell me how can I do it.</p>
|
php jquery
|
[2, 5]
|
3,194,176 | 3,194,177 |
Get specified texts in a div, than search for them in a different div
|
<p>I am trying to get texts from a div, than i want to search for these titles on the same page, but in a different div. And if one of the title exist there, i want to put some text after it. I tried to do it, but i don't know what is the problem. Last time i tried it with this jquery code:</p>
<pre><code>var cim = $.trim($('.hirblokk span.comments:contains("új")').parent(".hirblokk").children("h3").text());
jQuery.each(cim, function(X) {
$("ul.s_hir.show li.hir a:contains(X)").find("small").append(" (Új!)");
return (this == cim.length);
});
</code></pre>
<p>As you can see i put the texts what i wanted to 'cim'(it is working). Than i tried (line 3) to check if one of the 'ul.s_hir.show li.hir a' contains one of the text, and if it containes, i put (append) something in the small tag (there is a small tag inside a tag : Text..)(this is not working). I tried it in more ways, but none of them worked.
If i write:</p>
<pre><code>$("ul.s_hir.show li.hir a:contains(a)").find("small").append(" (Új!)");
</code></pre>
<p>than it will put ' (Új)' after every <em>small</em> tag when the <em>a</em> contains a character. So it looks like the problem is how i want to check if it <em>a</em> contains one of the text.
Oh, and i can get more than whan text for example: 'I am new' and 'Oh, hello darling' and only one of them contains *ul.s_hir.show li.hir a*</p>
|
javascript jquery
|
[3, 5]
|
4,581,778 | 4,581,779 |
about android project
|
<p>I have elseif statement in which i declare flag is false and i declare</p>
<pre><code>Resources r = getResources();
String refrigerant;
String[] refrigerant1 = r.getStringArray(R.array.refrigerant);
</code></pre>
<p>in my program want to set flag=true but my for loop is not executed and flag remains false
pls give me solution.</p>
<p>is there any problem in array declaration?</p>
<pre><code>else if (ref_flg == true && ptflg == false)
{
for (int i1 = 0; i1 < refrigerant1.length; i1++)
{
if (refrigerant == "")
{
if (et1.getText().toString()== refrigerant1[i1])
{
flag = true;
System.out.println("flag"+flag);
}
}
else
{
if (refrigerant == refrigerant1[i1])
{
System.out.println("refrigerant"+refrigerant);
flag = true;
System.out.println("flag"+flag);
}
}
}
if (flag == true)
{
if (refrigerant == "")
{
if (et1.getText().toString() != "")
{
refrigerant = et1.getText().toString();
}
}
temp_flg = true;
et1.setText("");
}
else
{
System.out.println("flag"+flag);
alertDialog.setTitle("Reset...");
alertDialog.setMessage("Enter Valid REF");
alertDialog.setButton2("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
// here you can add functions
dialog.dismiss();
}
});
alertDialog.setIcon(R.drawable.icon);
alertDialog.show();
ref_flg = false;
}
}
</code></pre>
|
java android
|
[1, 4]
|
420,889 | 420,890 |
jQuery code critque
|
<p>Thought I'd post here. My first hour on jQuery, actually first programing ever done. Would love to learn whats not right and how it could be better.</p>
<pre><code>$(function() {
function hide_me()
//A place to specify which elements you want hidden, on page load.
{
$("li.credentials").hide();
}
function first_bow()
//The div right_column takes a bow on initial load.
{
$("div#right-column").show("drop");
}
function bigpeek()
//The third column toggles in/out. All elements under div right_column.
{
$("div#right-column").toggle("drop", "fast");
}
function smallpeek()
//Smaller snippets like credentials or user assignment flying in/out.
{
$("li.credentials").toggle("drop", "fast");
}
$(document).ready(function() {
$("*").ready(hide_me);
$("*").ready(first_bow);
$(".btn-new-email").click(bigpeek);
$(".button").click(smallpeek);
$(".icon-delete").mouseover(function() {
$(this).effect("bounce", "fast");
});
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.