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 |
---|---|---|---|---|---|
1,582,588 | 1,582,589 |
How to return local date in another language?
|
<p>How can I return local date string in some other language and not in english?</p>
<p>I am using this:</p>
<pre><code>new Date().toLocaleDateString()
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,477,112 | 3,477,113 |
jQuery animation timeout
|
<p>I have an animation script implemented with jQuery. The issue is that it does not complete the animation before returning to the parent function. To clarify: the js changes a background color, the js function calls the animate function, the animation function begins, before it finishes it has already returned to the parent and continues on with the next line of js.</p>
<pre><code>function step5(){
/*code*/
currentNode.obj.style.backgroundColor="white";
movePacket(currentNode, objects[currentNode.switchName]);
objects[currentNode.switchName].obj.style.backgroundColor="#ADEBFF";
/*code*/
}
function movePacket(obj1, obj2){
var x = obj2.x - obj1.x;
var y = obj2.y - obj1.y;
$("#packet").animate({"left": "+="+x+"px", "top": "+="+y+"px"}, 3000);
}
</code></pre>
<p>I need for the code to wait for the animation to complete and then proceed. Any suggestions?</p>
|
javascript jquery
|
[3, 5]
|
4,132,588 | 4,132,589 |
Display server side data in C#
|
<p>I develop a project in that when the user select a particluar radio button I need to display some data in a listbox [these data come from a database]. I allow the user to select one item. This thing will happen in div.</p>
<p>How do I proceed?</p>
|
c# asp.net
|
[0, 9]
|
5,395,511 | 5,395,512 |
Need help with this error ::Invalid token '=' in class, struct, or interface member declaration
|
<p>trying to hide a panel of Master Page in my content page using the following code</p>
<pre><code> Panel p = this.Master.FindControl("panel1") as Panel;
p.Visible = false; //Error is showing on this line
</code></pre>
<p>Why this error ? Plz help..thnx</p>
|
c# asp.net
|
[0, 9]
|
2,132,811 | 2,132,812 |
Select elements whose children don't contain specific elements in jQuery
|
<p>I want to select all divs on a page whose children <strong>don't</strong> contain an element with a specific class. </p>
<p>I can select elements whose descendants <strong>do</strong> contain the class with: </p>
<pre>
$('div').has('.myClass');
</pre>
<p>So I just want the inverse of this. </p>
|
javascript jquery
|
[3, 5]
|
2,029,054 | 2,029,055 |
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]
|
3,335,743 | 3,335,744 |
Use a function to set a variable with Javascript?
|
<p>I am trying to use javascript and jquery to build an HTML table based on information returned from a database. I have the JSON and the database hit working properly, but I am unable to show the data on my page.</p>
<p>This is code to display the data</p>
<pre><code>var temp;
var init = function() {
$(_getMarketInfo()).appendTo(document.body);
// Used for logging
temp = $(_getMarketInfo());
console.log(temp);
};
</code></pre>
<p>And then to get and process the data</p>
<pre><code>function _getMarketInfo() {
$.ajax({
url:'scripts/db_getMarketInfo.cgi',
dataType:'json',
success:function(data, testStatus) {
var html = '';
html +='<div class="marketInfoHolder">';
html +='<table class="tbl" border=1>';
html +=' <tr><th>Market Information</th></tr>';
html +=' <tr><td>Market</td></tr>';
for (var i=0;i< data.marketInfo.length; i++){
html += '<tr><td>' + data.marketInfo[i].market_name + '</td></tr>';
}
html +='</table>';
html +='</div>';
//used for logging
console.log(html);
return html;
},
error:function(data, textStatus) {
alert('There was an error getting market information.');
}
});
};
</code></pre>
<p>According to the console logs, the html variable does have proper html code for a table, but then when I look at temp variable, it is logged as []. It appears that, for some reason, the _getMarketInfo() isn't properly returning html to temp.</p>
|
javascript jquery
|
[3, 5]
|
462,636 | 462,637 |
Check Object Exists throws Object Required Error
|
<p>I have a web form for data entry. The page requires an ID to be passed via query string. In the code behind I check the ID has been supplied. If it hasn't the form (in a panel) is hidden and an error message is displayed.</p>
<p>In the html I have a JQuery script block that attaches an event (downloaded date picker). </p>
<pre><code> window.onload = function() {
new JsDatePick({
useMode: 2,
target: "txtDateOfIncident",
dateFormat: "%d %M %Y"
});
};
</code></pre>
<p>If the code behind hides the form the JQuery throws an error <code>Object Required</code></p>
<p>So in the JQuery I am trying to test existance of the object <a href="http://stackoverflow.com/questions/5293041/jquery-how-to-check-if-an-element-exists" title="Found here">As per this post</a>... </p>
<pre><code> window.onload = function() {
if ($('#txtDateOfIncident').length) {
new JsDatePick({
useMode: 2,
target: "txtDateOfIncident",
dateFormat: "%d %M %Y"
});
}
};
</code></pre>
<p>Now I get the <code>Object Required</code> error on the <code>$('#txtDateOfIncident').length</code> code.</p>
<p>Any help to resolve this would be appreciated.</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
3,987,177 | 3,987,178 |
jQuery find/each script not working
|
<p>there must be something small ive overlooked here. I'm simply trying to select all DT elements in a DL and insert some HTML and add a click event, however it only seems to be applying to the first DT.</p>
<p>Here's the snippet from my plugin: </p>
<pre><code> return this.each(function(){
var questions = $(this).find('dt');
questions.each(function(){
$(this).attr("title","Show answer"); // add screen tip
$(this).wrapInner("<span class='faqToggleQues' />");
$(this).prepend("<span class='faqToggleNumber'>"+numPrefix+(i+1)+numSubfix+"</span>");
});
});
</code></pre>
<p>Also I have hosted the code on jsFiddle <a href="http://jsfiddle.net/mindfriction/u6WYQ/" rel="nofollow">http://jsfiddle.net/mindfriction/u6WYQ/</a></p>
|
javascript jquery
|
[3, 5]
|
3,435,017 | 3,435,018 |
submit onChange using pretty url's
|
<p>i've already opened a question for this problem, but it was very bad formulated and because of that i did not get a good response.... so heres another try... hope it's ok</p>
<hr>
<p>i have a form with a selected tag and some options inside</p>
<pre><code><form>
<select>
<option selected="selected"></option>
<option value="1" data-seourl="food-intake">Food intake</option>
<option value="2" data-seourl="homemade-cake">Homemade cake</option>
<option value="3" data-seourl="good-fruits">Good fruits</option>
<option value="4" data-seourl="apple-type">Apple type</option>
</select>
</form>
</code></pre>
<p>When i select an option (onchange) i want to submit a friendly url to the server that ressembles this:</p>
<pre><code>http://www.mywebsite/kitchen/food-intake.1
http://www.mywebsite/kitchen/homenade-cake.2
...
</code></pre>
<p>instead of sending the default:</p>
<pre><code>http://mywebsite/kitchen/?category=1
http://mywebsite/kitchen/?category=2
</code></pre>
<p>I know how to use mod_rewrite, so that's not a problem. I need to understand how to submit a friendly url instead of the default?</p>
<p>Is javascript (jQuery in this case) the only solution or is there a native solution?</p>
<p>Thanks</p>
|
php jquery
|
[2, 5]
|
5,976,457 | 5,976,458 |
My android service causes the app to crash
|
<p>I'm trying to call a method of another class but this causes my app to crash.</p>
<p>This is what I'm doing to run it on boot</p>
<pre><code>public class BootReceiver extends BroadcastReceiver{
@Override
public void onReceive(Context context, Intent intent) {
MyApp test = new MyApp();
test.run_service();
}
}
</code></pre>
<p>I've commented out all the lines from run_service() to find out what the cause is, and it's this line</p>
<pre><code>SharedPreferences settings = getApplicationContext().getSharedPreferences(PREFS_NAME, 0);
</code></pre>
<p>It works fine if I call it from within that class (when the application is the foreground), so why can't I call it from inside onReceieve?</p>
<p>Updated to add notification code:</p>
<pre><code>CharSequence title = "MyApp";
CharSequence message = "Hello World";
NotificationManager nm = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
Notification n = new Notification(R.drawable.icon, "Hi!", System.currentTimeMillis());
Intent notificationIntent = new Intent(context, MyApp.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, notificationIntent, 0);
n.setLatestEventInfo(MyApp.this, title, message, pendingIntent);
nm.notify(NOTIFICATION_ID, n);
</code></pre>
|
java android
|
[1, 4]
|
1,711,897 | 1,711,898 |
Adding a div label to all blockquote elements with jQuery
|
<p>The html:</p>
<pre><code> <blockquote>
test,test
</blockquote>
<p>test tow</p>
<blockquote>
test2,test3
</blockquote>
</code></pre>
<p>I want to make the html to the folowing by jQuery:</p>
<pre><code> <div class="quote">
<blockquote>
test,test
</blockquote>
</div>
<p>test tow</p>
<div class="quote">
<blockquote>
test2,test3
</blockquote>
</div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,682,385 | 3,682,386 |
Add simple text to panel control
|
<p>I have a panel in C#:</p>
<pre><code> Panel aspPanel = new Panel();
Button aspbutton = new Button();
aspbutton.Text = "Download PDF";
aspbutton.Click += initDownload;
aspPanel.Controls.Add(aspbutton);`
</code></pre>
<p>I have added Attributes and buttons and all kinds of cool dynamic stuff. But I want to just add simple text and so far am unsuccessful.</p>
<p>I'm looking for how to add text behind the button. In the end the HTML code would render something like:</p>
<pre><code> <input type="button"/> Hello, this is a button, please click
</code></pre>
<p>Can someone point me in the right direction?</p>
|
c# asp.net
|
[0, 9]
|
2,083,197 | 2,083,198 |
In Java, what does a reference to Class.class do?
|
<p>I'm building a small Android application, but this is more of a Java question than an android question. Looking through the tutorials there are lines that look like:</p>
<pre><code>startService(new Intent(this, MyService.class));
</code></pre>
<p>what exactly does the "MyService.class" field represent? Is that just a reference to the class for a template?</p>
<p>Thanks.</p>
|
java android
|
[1, 4]
|
1,818,879 | 1,818,880 |
non-final variable inside an inner class
|
<p>I try to create dynamically a ImageView and I want to pass this imageView as a parameter to a method into the listener.</p>
<pre><code> ImageView imageView1 = new ImageView(LookActivity.this);
imageView1.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View arg0, MotionEvent arg1) {
detectLocationAndShowPopUp(imageView1);
return true;
}
})
</code></pre>
<p>But I'm taking the following error:<br>
Cannot refer to a non-final variable imageView1 inside an inner class defined in a different method.</p>
<p>I don't want to declare the imageView as final. How can I overcome this problem?</p>
|
java android
|
[1, 4]
|
2,870,909 | 2,870,910 |
Does jQuery have a method for checking all values of an array to see if they meet some criteria?
|
<p>I'm looking for something similar to Groovy's <a href="http://groovy.codehaus.org/groovy-jdk/java/lang/Object.html#every%28%29" rel="nofollow">every()</a> method, which tests every element of a list if it meets some criteria. If they all meet the criteria, the function returns true. Otherwise, false. I've tried something like this:</p>
<pre><code>var arr = [1, 0, 1, 0, 1, 1];
var allOnes = $.grep(arr, function(ind) {
return this == 1;
}).length == arr.length;
</code></pre>
<p>..but its not very clean. I haven't had any luck while searching through the API. Is using <code>grep()</code> the only way to do it? </p>
|
javascript jquery
|
[3, 5]
|
2,008,318 | 2,008,319 |
how to download a file from server, using asp.net website
|
<p>I am trying to download a file from the server, I am getting access denied error, the path is different from what I am giving as input, how can I pass the correct path</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
string FileLoc = @"~/Upload/1984_Apple_Macintosh_Commercial.mp4";
DownloadData(FileLoc);
}
public void DownloadData(string address)
{
var path = Path.Combine(Request.PhysicalApplicationPath, address);
using (var client = new WebClient())
{
client.DownloadFile(path, "1984_Apple_Macintosh_Commercial.mp4");
}
}
</code></pre>
<blockquote>
<p>Access to the path 'C:\Program Files (x86)\Common Files\Microsoft
Shared\DevServer\10.0\1984_Apple_Macintosh_Commercial.mp4' is denied.</p>
</blockquote>
<p>Updated Code</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string FileLoc = @"c:\Files\1984_Apple_Macintosh_Commercial.mp4";
DownloadData(FileLoc);
}
}
public void DownloadData(string address)
{
var path = Path.Combine(Request.PhysicalApplicationPath, address);
WebClient Client = new WebClient();
Client.DownloadFile(path, @"c:\Files\1984_Apple_Macintosh_Commercial.mp4");
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
1,881,737 | 1,881,738 |
bxSlider plugin not loading the classes
|
<p>I am using bxSlider plugin on my site it is working fine on my local machine but on my staging server it is not working the problem is i think it is not loading the classes because I cant see the bx-wrapper, bx-window etc classes on my staging server while these class comes on my local machine.
The jquery.bxSlider.min.js is there in js folder on staging server
Anyone has any idea why its not working ?</p>
<p>Thanks in advance</p>
|
php jquery
|
[2, 5]
|
634,502 | 634,503 |
Clicking a Dynamically Generated div that opens another dynamically generated Div
|
<p>ok, Im going to pass on submitting how I would do this...because I dont want a patch to an otherwise crappy piece of code. Heres what Im trying to do: I use php to output some divs. A corresponding set of divs is generated with the first divs. The whole idea is that when the first div is clicked, the corresponding div slides down. My attempts at this so far have been unsuccessful. Im guessing the id is going to have to correspond with the class of the other div or something to that affect. I've been baking on this one for awhile. Any help is really appreciated!</p>
|
php jquery
|
[2, 5]
|
3,149,690 | 3,149,691 |
Adding,removing array elements and accessing via php
|
<p>I have the following codes. Each time a user click on a photo, its title is pushed into an array. If he clicks again, the title is removed. I want to be able to access the array later on with php so i can populate a database.</p>
<pre><code>function highlight(elem) {
var e = array();
if (elem.style.border == '2px solid blue') {
var index = e.indexOf(elem.parentNode.title);
e.splice(index, 1);
elem.style.border = '';
} else {
elem.style.border = '2px solid blue';
e.push(elem.parentNode.title);
}
}
</code></pre>
<p>Is this the correct way of doing it? How do i access the javascript array with php? </p>
|
php javascript
|
[2, 3]
|
2,140,538 | 2,140,539 |
jQuery Remove specific span based on id
|
<p>I want to be able to remove only spans which has an id that stars with the key word "junk_"</p>
<p>for example if I have </p>
<pre><code><span id="junk_8345">A</span>
<span id="valid_2972">B</span>
<span id="junk_9249">C</span>
</code></pre>
<p>The output should look like</p>
<pre><code><span id="valid_2972">B</span>
</code></pre>
<p>I've tried to use</p>
<pre><code>$("span:has(junk)").remove();
</code></pre>
<p>but it does not seem to work. I'm open to use regex expression with the replace function if I can accomplish the same goal. Any help would be greatly appreciated!</p>
|
javascript jquery
|
[3, 5]
|
3,914,142 | 3,914,143 |
Jquery - Grab Variable from Another Function
|
<p>I have two functions on my page. I am trying to find a way to access a variable in function 1 inside function 2:</p>
<pre><code>$(function() {
$('a[id=1]').live("click", function(event) {
event.preventDefault();
var Var1 = "something1";
});
});
$(function() {
$('a[id=2]').live("click", function(event) {
event.preventDefault();
var Var2 = event.var1;
});
});
</code></pre>
<p>So i am usre my above is incorrect but you can see how in function 2 i am trying to grab a variable from the first function. Is there any way i can do this. I don't know why but i keep thinking it has something to do with the event.var1 or the event functionality. Any help would be appreciated. Thank you.</p>
|
javascript jquery
|
[3, 5]
|
5,931,508 | 5,931,509 |
How to disable sorting on column in jQuery.tablesorter?
|
<p><br><br>i try to find a way how to disable sorting on column. I use jquery tablesorter.
And by default if you click on header cell it sort column data, but what i need to do if i don't need to use sorting on one or two column in four columns table.
<br><br>
Thanks in advanced.</p>
|
javascript jquery
|
[3, 5]
|
3,190,322 | 3,190,323 |
Caching asp.net pages
|
<p>I am bulding an app and I tried YSlow and got Grade F on most of my practices. I have loads of jscript that am working on reducing. I want to be able to cache some of these because the pages get called many times.</p>
<p>I have one master age and I wanted to cache the scripts and css files.</p>
<p>How do I achieve this?
Are there any recommended best practices?
Are there any other performance improvements that I can make?</p>
|
c# asp.net
|
[0, 9]
|
1,194,900 | 1,194,901 |
PHP script sample for iPhone hi-score/survey uploading?
|
<p>I am looking for a PHP example/tutorial which can accept hi-scores/survey upload from an iPhone. Hopefully, the PHP script:</p>
<ul>
<li>accepts POST, in additional to GET</li>
<li>works over SSL (https)</li>
<li>connects to MySQL</li>
</ul>
<p>In addition, it'd best the iPhone can get a session from the server and submit the session value along with the hi-score. Thanks</p>
|
php iphone
|
[2, 8]
|
4,514,282 | 4,514,283 |
PopUp at the end of button's operations
|
<p>in my aspx page I have a button that save several values in the database. </p>
<p>I need to insert a popuup at the end of the operation. </p>
<p>At the moment the code is: </p>
<pre><code>protected void btnSendRequest_Click(object sender, EventArgs e)
{
var myDbAccess = new DBAccess();
Event newEvent = (Event)Session["NewEvent"];
myDbAccess.SaveEvent(newEvent);
// Insert here a PopUp like "Successfully saved!"
}
</code></pre>
<p>How can I accomplish this? </p>
<p>Luigi</p>
|
c# asp.net
|
[0, 9]
|
5,745,766 | 5,745,767 |
parse a password protected json url using jquery
|
<p>I have a json url that can be accessed after authentication of username and password.How to put authentication dynamically while parsing the url?</p>
|
javascript jquery
|
[3, 5]
|
2,838,701 | 2,838,702 |
Reset the Value of a Select Box
|
<p>I'm trying to reset the value of two select fields, structured like this,</p>
<pre><code><select>
<option></option>
<option></option>
<option></option>
</select>
<select>
<option></option>
<option></option>
<option></option>
</select>
</code></pre>
<p>jQuery,</p>
<pre><code>$('select').each(function(idx, sel) {
$(sel).find('option :eq(0)').attr('selected', true);
});
</code></pre>
<p>Unfortunately, no matter how many ways I try it, it just doesn't happen. Nothing in the console. I have no idea what's going on? I know there has to be a way to do this, you can do <strong>anything</strong> with JS</p>
<p>EDIT: </p>
<p>I figured out that the issue only occurs when I try to fire the code on the click of a dom element, however, I know that the code should be working, because when I have</p>
<pre><code>$('p').click(function(){
console.log('test');
});
</code></pre>
<p>It outputs 'test' to the console, but when I include the code in this function, nothing happens. Why is this?</p>
|
javascript jquery
|
[3, 5]
|
5,350,005 | 5,350,006 |
How to create subscription in Google Calendar?
|
<p>Previously I've created a subscription using GData and myService.insert(feedUrl, calendarEntry);
But GData is not supported for Android - one should use google-api-java-client.</p>
<p>How can I create a subscription to an existing caledar using google-api-java-client library?</p>
|
java android
|
[1, 4]
|
4,292,870 | 4,292,871 |
jquery, how to use trigger?
|
<p>i have this situation:</p>
<pre><code>if(isset($_POST["sm"]){
print "<br><div id=\"redirect\">success</div>";
}
</code></pre>
<p>in javascript i have:</p>
<pre><code>$('#redirect').delay(2000).fadeOut('slow');
</code></pre>
<p>what happens is that if the form is submitted that div shows up for two seconds then faced out, but i also want to trigger a click by using: <code>$('#test').trigger('click');</code></p>
<p>how can i connect them together so that when the div shows i also trigger the click.</p>
<p>also i cant use javascript inside the php if statement</p>
<p>any ideas?</p>
<p>thanks</p>
|
php jquery
|
[2, 5]
|
4,211,575 | 4,211,576 |
Value cannot be null. Parameter name: type : ASPnet Error after deploy
|
<p>Working local when deployed fails.</p>
<p>Error :</p>
<blockquote>
<p>MESSAGE: Value cannot be null. Parameter name: type</p>
<p>SOURCE: mscorlib</p>
<p>TARGET SITE: CreateInstance</p>
<p>STACK TRACE: System.Activator.CreateInstance(Type type, Boolean
nonPublic) System.Activator.CreateInstance(Type type)
ClientPortal.WebPages.Details.imgToDOC_Click(Object sender,
ImageClickEventArgs e)
System.Web.UI.WebControls.ImageButton.OnClick(ImageClickEventArgs e)
System.Web.UI.WebControls.ImageButton.RaisePostBackEvent(String
eventArgument)
System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</p>
</blockquote>
|
c# asp.net
|
[0, 9]
|
1,476,091 | 1,476,092 |
How to differentiate the request from Web View or normal browser
|
<p>We have developed a HTML5 application. We have to show the application in both the normal browser and in the iphone web view. We have done the implementation for the webview. Now we just want to differentiate whether the request is coming from the normal browser or webview. Any solution in c# .net or javascript</p>
<p>Thanks in advance </p>
|
c# iphone asp.net
|
[0, 8, 9]
|
1,657,336 | 1,657,337 |
What does the $ sign mean in Jquery or JavaScript?
|
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/1150381/what-is-the-meaning-of-sign-in-javascript">What is the meaning of “$” sign in javascript</a> </p>
</blockquote>
<p>Now this must seem to be an easy and stupid question to ask but I must know why we use the dollar ($) symbol in Jquery and JavaScript.
I always put a dollar in my scripts but I actuary don't know why.</p>
<p>For an example:</p>
<pre><code>$('#Text').click(function () {
$('#Text').css('color', 'red')
});
</code></pre>
<p>This just changes the text colour when you click it, but it chose my point</p>
|
javascript jquery
|
[3, 5]
|
1,460,321 | 1,460,322 |
How can I Enable\Disable all subcontrols of a table?
|
<p>I have a checkBox, which when it's checked i want to enable a table and its subcontrols and when it's disabled I want to do the opposite.</p>
<p>I have already understand that I have to iterate all subControls of the table, and my question is if there is any nice and generic way of doing it.</p>
<p>Thanks in advance,</p>
<p>oz.</p>
|
c# javascript
|
[0, 3]
|
5,374,041 | 5,374,042 |
How to use data created by JS in PHP?
|
<p>This is my code</p>
<pre><code><script type="text/javascript">
function countNumber(){
var number = 10;
document.getElementById("n").innerHTML=number;
}
</script>
<body onload="countNumber()">
<?php
$a = "?"; //<-- here i want to get the innerHtml of the "n"-id-element
echo $a+1;
?>
</body>
</code></pre>
<p>How do I access the HTML-data at the initialization of $a?</p>
|
php javascript
|
[2, 3]
|
3,164,890 | 3,164,891 |
Javascript find text on page
|
<p>I need to run a search and replace on HTML similar to the following... I need to have "Find Next" "Replace" and "Replace All" options.... the trick is that I need to run an AJAX request to update the values in the database for each field once the value is replaced.</p>
<p>The only trouble I'm running into is that I"m unsure exactly how to search the contents of <code>#sheet</code> and replace the values with the new value the user has provided.</p>
<pre><code><div id='sheet'>
<div class='item' id='field-18583'>This is yet another test</div>
<div class='item' id='field-18585'>This is test data</div>
</div>
</code></pre>
<p>I should say that it's possible I'll have TONS of text to search, so ideally I'd only find the next instance of the item that's being searched for, not all instances. So when I hit "Find Next", if I"m 3 items in, it'll go to the 4th.</p>
<p>What's the best way in javascript to maintain the indexing on this without storing all found results in a variable and causing lag on the page?</p>
|
javascript jquery
|
[3, 5]
|
1,068,949 | 1,068,950 |
Toggle element visibility with jQuery!
|
<p>I have the following markup:</p>
<pre><code><div class="header">Text</div>
<div class="hiddenArea">sdsada</div>
<div class="header">Text2</div>
<div class="hiddenArea">sdsada</div>
</code></pre>
<p>and the following jQuery:</p>
<pre><code>$('.header').click(function() {
var t = $(this).next('.hiddenArea').slideToggle();
});
</code></pre>
<p>When the hiddenArea is revealed I want to hide the other hiddenArea if it is visible?
I want to make this so that I can add other headers and hiddenAreas if I need them.</p>
<h3>Update:</h3>
<p>Thanks Guys, ended up doing this:</p>
<pre><code>$('#messages .header').click(function() {
if (!$(this).next().is(':visible')) {
$('.hiddenArea').slideToggle();
}
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
545,836 | 545,837 |
How to convert .pdf to .png
|
<p>Using ImageMagick I can convert any pdf document into images by using command "convert":</p>
<pre><code>convert abc.pdf abc.png
</code></pre>
<p>This will convert all pdf pages to png images.</p>
<p>How can I implement this using PHP or Java so that I can provide this functionality on my website to enable users to read books online as Google Books does.</p>
|
java php
|
[1, 2]
|
5,156,375 | 5,156,376 |
Load user control data after page postback?
|
<p>I have a page where a user can update their user information (like their first name). I also have a user control on this page that displays a lot of information, including the user's first name.</p>
<p>My problem I'm having is that when I change the first name on this page, the user control isn't updated after I save the data.</p>
<p>Here's my front end:</p>
<pre><code><UC:LeftNav ID="leftNav" runat="server" />
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox>
<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click" />
</code></pre>
<p>My button click event to save the user info:</p>
<pre><code>protected void btnSave_Click(object sender, EventArgs e)
{
...
user.FirstName = txtFirstName.Text();
user.Save();
...
}
</code></pre>
<p>My user control that displays the user info:</p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
...
lblFirstName.Text = user.Firstname;
...
}
</code></pre>
<p>I went through the debugger, and I found that the <code>btnSave_Click</code> event on my page occurs <em>after</em> the <code>Page_Load</code> event of my user control.</p>
<p>Is there a way that I can get the <code>btnSave_Click</code> event to occur <em>before</em> I load the user data in my user control?</p>
|
c# asp.net
|
[0, 9]
|
383,656 | 383,657 |
get id of first div in page loaded via ajax
|
<p>I'm using $.get function for loading partial view:</p>
<pre><code>$.get('/desk/nextstep', function (data) {
var ids = $(data).filter(':first').attr('id');
alert(ids);
});
</code></pre>
<p>I want to get <code>id</code> of first(root) div, but this code not works:</p>
<pre><code>var ids = $(data).filter(':first').attr('id');
</code></pre>
<p>I get <code>undefined</code> alert message. How to solve it?<br>
Thanks.</p>
<p><strong>UPDATE:</strong>
In the <code>data</code> html code:</p>
<pre><code><div id="step1" class="scroll-pane">
<div class="scroll_cont">
//other content
</div>
</div>
</code></pre>
|
javascript jquery
|
[3, 5]
|
4,161,683 | 4,161,684 |
jQuery load an image and swap by click
|
<p>I have the following code on start to call the main image:</p>
<pre><code>$(function () {
var img = new Image();
$(img).load(function () {
//$(this).fadeOut('normal');
$('#bg div table tr td').removeClass('loading').append(this);
$(this).fadeIn();
}).attr('src', 'images/home.jpg');
});
</code></pre>
<p>Thats working so far. On click of an link i want to fade that one out and than load a second one in there. Somehow i cant get it to work... There are a lot of images that have to be loaded by clicking an element in the navigation, i´m not shure about the code. Any idea?</p>
|
javascript jquery
|
[3, 5]
|
3,310,303 | 3,310,304 |
How do I denied user access script directly in URL
|
<p>I have a jQuery script using <code>.live()</code> to load it's page content.</p>
<pre><code>$('#content').load("content.php?" + id);
</code></pre>
<p>Question: How can I deny a user from accessing the file <code>content.php</code> directly via a URL?</p>
<p>I tried to put this code on top of <code>content.php</code> but Access Denied appear in my <code>#content</code> div</p>
<pre><code>if (!empty($_SERVER['SCRIPT_FILENAME']) && 'content.php' == basename($_SERVER['SCRIPT_FILENAME']))
die('Access Denied');
</code></pre>
<p>What is the correct way to make sure users can't access my <code>content.php</code> file using a URL?</p>
|
php jquery
|
[2, 5]
|
5,296,385 | 5,296,386 |
WVGA800 (480x800) & Density ANDROID
|
<p>Table 3 on this page:
<a href="http://developer.android.com/guide/practices/screens_support.html" rel="nofollow">http://developer.android.com/guide/practices/screens_support.html</a></p>
<p>shows that WVGA800 (480x800) is available with 3 Densities. Does this mean that for each density the game will be loaded with different DPI assets if available ?</p>
<p>But how come same resolution will have different assets or layouts?</p>
|
java android
|
[1, 4]
|
2,215,431 | 2,215,432 |
confusion in jquery parents selector with hasClass function
|
<pre><code>var allChecked = $('.inboxCheckbox:checked');
if(allChecked.length > 0){
var messageIds = new Array();
var parentRow = null;
allChecked.each(
function(){
parentRow = $(this).parents('tr');
if(!(parentRow.hasClass('gradeA'))){
parentRow.addClass('gradeA');
increaseUnreadMessage();
}
parentRow = null;
messageIds.push($(this).val());
}
);
}else{
showInsMessage('<b class="redTxt">Please Select At Least One Message</b>');
}
</code></pre>
<p>i have multiple rows with once checkbox in each row... i was trying to add class gradeA to each row if checkbox is checked.... i do not want to call addClass if it already has class gradeA.... when i select multiple rows then it adds class to only one row. does that mean </p>
<p>lets say i have three rows with checkbox in each row and i select each checkbox when i run
<code>$(':checked').each(
$(this).parents('tr')
)</code>does it select all the rows with checked boxes or only the specfic parent row.... my assuption was it only gives the specific parent row..... if it gives specific row then it should work .. but once i add a class to parent row and move to another row then parentRow.hasClass('gradeA') return true... i am confused now if it checks all the row with checkboxes then is there any way to select specific parent row......</p>
<p>Thanks for reading</p>
|
javascript jquery
|
[3, 5]
|
1,466,034 | 1,466,035 |
Uploading multiple files with size restriction in Javascript
|
<p>Can anybody tell me how i can upload multiple files with size restriction in javascript.</p>
|
javascript python
|
[3, 7]
|
1,675,489 | 1,675,490 |
Object reference not set to an instance of an object for repeater
|
<p>Basically I wish to get my dynamic <code>CheckboxList.SelectedItem.Text</code> but I failed to do so. When I checked one of the items in CheckboxList, it can't detect that I am checked the item.</p>
<p><strong>my checkboxlist item</strong></p>
<p>A</p>
<p>B</p>
<p>C</p>
<p>D</p>
<p><strong>output(after checked A)</strong></p>
<p>You check nothing</p>
<p>You check nothing</p>
<p>You check nothing</p>
<p>You check nothing</p>
<p><strong>expected output(after checked A)</strong></p>
<p>A</p>
<p><strong>my page.aspx</strong></p>
<pre><code>protected void Page_Load(object sender, EventArgs e)
{
//load question for test
if (Session["test"] != null)
{
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
SqlCommand cmdLoadQuestion = new SqlCommand("getTestQuestion", conn);
conn.Open();
cmdLoadQuestion.Parameters.Add("@subject", SqlDbType.VarChar).Value = Session["test"].ToString();
cmdLoadQuestion.CommandType = CommandType.StoredProcedure;
SqlDataReader dtrLoadQuestion;
dtrLoadQuestion = cmdLoadQuestion.ExecuteReader();
Repeater1.DataSource = dtrLoadQuestion;
Repeater1.DataBind();
dtrLoadQuestion.Close();
conn.Close();
}
else
{
Response.Redirect("~/HomePage.aspx");
}
}
CheckBoxList chk = ((CheckBoxList)Repeater1.Items[0].FindControl("chkOption"));
foreach (ListItem li in chk.Items)
{
if (li.Selected)
{
Response.Write(li.Text);
}
else
{
Response.Write("You Check Nothing");
}
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
4,601,760 | 4,601,761 |
Any jQuery plugin like the Yahoo Profile?
|
<p>I am creating a website that user must add some data like date, place e.t.c. and I saw Yahoo Profile having this cool thing where you can add for example your name by just clicking on that specific area. My question is if anyone knows a similar plugin or how should I start to build this?</p>
<p>My goal is to let user input and submit it.</p>
<p><img src="http://i.stack.imgur.com/G641X.png" alt="enter image description here"></p>
|
javascript jquery
|
[3, 5]
|
3,369,777 | 3,369,778 |
Make div toUpperCase()
|
<p>I've been looking for a script that makes all text in every div to uppercase letters.
I found this script:</p>
<pre><code><script type="text/javascript" src="Script/jquery-1.3.2.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$("div").text($("div").text().toUpperCase());
});
</script>
</code></pre>
<p>From:<a href="http://www.dotnetfunda.com/codes/code638-change-text-to-uppercase-using-jquery-.aspx" rel="nofollow">here</a></p>
<p>However, this script takes every div, and adds it onto the previous and repeats it down the document... it's hard to explain.</p>
<p>I would think that</p>
<pre><code>$("div").text().toUpperCase();
</code></pre>
<p>alone should work... but it doesn't.</p>
<p>I feel like this should be really simple...</p>
<p>Any and all help is appreciated!</p>
<p><strong>EDIT</strong></p>
<p>I cannot do this with IDs! It has to be with the actual elements.</p>
|
javascript jquery
|
[3, 5]
|
5,595,663 | 5,595,664 |
live search jquery (searching in li title)
|
<p>I try to search with an input field a list of items,</p>
<pre><code><ul class="display">
<li title="Pizza Otto">some divs</li>
<li title="Pizza Prono">some divs</li>
<li title="Pizza David">some divs</li>
</ul>
</code></pre>
<p>The code below works fine for words in the <code><li>...</li></code> I want to put there some divs and to add a title attribute to <code><li></code> where to make the search. </p>
<pre><code>$('input[name="q"]').search('.display li', function(on) {
on.all(function(results) {
var size = results ? results.size() : 0
$('#count').text(size + ' results');
});
</code></pre>
<p>Any idea for the right selector here: <code>.search('.display li'</code>? Or where I have to make the changes? </p>
<p>Thanks and sorry for my English...</p>
<p>P.S. Is my first question here!</p>
<p>UPDATE: function to test if the val is contained</p>
<pre><code> function query(selector) {
if (val = this.val()) {
return $(selector + ':contains("' + val + '")');;
} else {
return false;
}
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,048,690 | 2,048,691 |
Adjusting jQuery script to add height to parent element
|
<p>I'm using Soh Tanaka's script to toggle open and closed div content in the accordion style.</p>
<pre><code><script language="javascript" type="text/javascript">
$(document).ready(function(){
//Hide (Collapse) the toggle containers on load
$(".toggle_container").hide();
//Switch the "Open" and "Close" state per click then slide up/down (depending on open/close state)
$("h3.trigger").click(function(){
$(this).toggleClass("active").next().slideToggle("slow");
return false; //Prevent the browser jump to the link anchor
});
});
</script>
</code></pre>
<p>I'm trying to adapt this script so that the toggle also adds an increase of 50px to the height of a container div with the id of #join_find_talk. Help, please... </p>
<p>You can see it in action here: <a href="http://www.snakeandherring.com.au/join/" rel="nofollow">http://www.snakeandherring.com.au/join/</a></p>
|
javascript jquery
|
[3, 5]
|
4,745,341 | 4,745,342 |
How can i pass a parrameter from Asp to jquery?
|
<p>i have a Listview with dynamics rows that read them from database.
now i want when mouse is going on one of it's data perform special work on it.(like bellow code)</p>
<pre><code> $(document).ready(function(){
$("*").mouseover(function () {//this line
$("*").animate({ //this line
width: "120px",
height:"120px",
}, 150);
});
</code></pre>
<p>my problem is that what i must write instead <code>*</code>,because their ids a changing dynamically and i can't user from <code>class</code> .
how can i do that?</p>
|
jquery asp.net
|
[5, 9]
|
4,777,358 | 4,777,359 |
Accessing RepeaterItem Controls in an EventHandler
|
<p>I have a page with a repeater in it. I'm writing an event handler so that when the user clicks my WebControl button, the event handler for said button iterates through the items in the repeater using FindControl, then uses some of the controls' values. It seems though, that after the page is loaded, the repeater items populate, but when the button is clicked to post this back, as I iterate through the repeater items, I'm seeing that they're all empty. I don't completely understand the sequencing, but I'm assuming it's because my iteration code is trying to access RepeaterItems that haven't been set yet.</p>
<p>The repeater code is in my OnLoad method. Outside of that, I have my event handler trying to iterate through those items after being clicked. This is essentially what I was trying to do:</p>
<pre><code>protected void MyButton_Click(object sender, EventArgs e)
{
foreach(RepeaterItem item in MyRepeater.Items)
{
MyLabel = (Label)item.FindControl("MyLabel");
}
}
</code></pre>
<p>The button is located in the FooterTemplate of the repeater.</p>
<pre><code><asp:Button runat="server" OnClick="SubmitChecklist_Click" cssclass="BlueSubmit" id="SubmitChecklist" text="Submit" />
</code></pre>
<p>Thanks in advance.</p>
<p>Edit: To clarify, the exact error I'm getting is NullReferenceException, when I try to do something, for instance, Response.Write(MyLabel.Text)</p>
<p>Edit: After looking into it more today, this is what I understand to be happening: The repeater is databound on postback. When I then make selections from the generated dropdownlists and hit my button, it posts back again. At this point, the repeater is databound again to it's initial values. So, if I must postback in order to get the users' selections, how can I go about this in the button's eventhandler so that I can get the selected values before that repeater gets databound again?</p>
|
c# asp.net
|
[0, 9]
|
2,521,248 | 2,521,249 |
Splitting string with multiple delimiters into a hash table in JavaScript
|
<p>I'm trying to figure out how to split a string using regex while having the results placed into a hash table.</p>
<p>Example:</p>
<pre><code>var x = "Name: John Doe
Age: 30
Birth Date: 12/12/1981";
var arr = x.split(/Name:|Age:|Birth Date:/);
</code></pre>
<p>However while I can spit a string the problem is I can't store the values into a useful format such as a hash etc. Since some of the information may not always be shown.</p>
<p>I would want the results to be something like:</p>
<pre><code>var myHash = {}; // New object
myHash['Name'] = "John Doe";
myHash['Age'] = "30";
myHash['Birth Date'] = "12/12/1981";
</code></pre>
<p>Is there an easy why to do this?</p>
<p>Edit: The script is used to parse data from a generated report. And the format does not always have carriage returns. It's going to be used to automatically generate notices instead of hand typing everything.</p>
<p>Example:</p>
<pre><code>Name: John Doe Birth Date: 12/12/1981
Age: 30
</code></pre>
<p>However, after seeing examples I may be able to do it if I first add a carriage return or other special character in front of the regex matches. Need to figure out how to add a value in front of the regex matches first.</p>
|
javascript jquery
|
[3, 5]
|
2,144,496 | 2,144,497 |
Something is overriding some of my jigoshop widgets
|
<p>I'm creating my first eCommerce wordpress website which I have work on for weeks now, I'm nearly at finished but some of the jigoshop widgets and features are not working for example the price filter is not showing up and the fancy box feature isn't showing up too.</p>
<p>I have a demo of the site up at <a href="http://demo.remi-niscenthair.com/shop/" rel="nofollow">http://demo.remi-niscenthair.com/shop/</a> I would be very grateful for any advice on how to get these issues sorted. </p>
|
php jquery
|
[2, 5]
|
1,677,875 | 1,677,876 |
How to make a video using Intent?
|
<p>There is the following code for starting video recording using Intent:</p>
<pre><code>startActivityForResult(new Intent(MediaStore.ACTION_VIDEO_CAPTURE), 100);
</code></pre>
<p>But there is some problem: it works good on my device, i.e. I recorded some video, then clicked by "complete" button in standard video recorder and all was good. But if user used device with Android less then 4.0 his device might have no "complete" button, therefore user could record, but couldn't save this new video and my onActivityResult() method got null in data field of Intent. Please, tell me, is there any universal way to start Intent for record video using Intent? </p>
|
java android
|
[1, 4]
|
3,358,955 | 3,358,956 |
How to delete DOM element based on attribute value
|
<p>I have this HTML code from Sharepoint and I was wondering if it's possible to delete this specific DOM element based only on the "text" attribute?</p>
<pre><code><ie:menuitem menugroupid="200" text="new docs view" onmenuclick="window.location = '/some link/';" type="option" id="zz36_View1"></ie:menuitem>
</code></pre>
<p>Using Firebug I can simply right click the above line and click delete element. How do I do this using Javascript w/ Jquery?</p>
<p>Here's some context of where the above line came from:</p>
<pre><code><span style="display:none">
<menu compactmode="true" id="zz34_ViewSelectorMenu" type="ServerMenu">
<ie:menuitem menugroupid="100" text="All Documents" onmenuclick="window.location = '/some link/';" type="option" id="zz35_DefaultView"></ie:menuitem>
<ie:menuitem menugroupid="200" text="new docs view" onmenuclick="window.location = '/some link/';" type="option" id="zz36_View1"></ie:menuitem>
<ie:menuitem menugroupid="300" text="Explorer View" onmenuclick="window.location = '/some link/';" type="option" id="zz37_View2"></ie:menuitem>
</menu>
</span>
</code></pre>
<p>I tried something like:</p>
<pre><code><script language="Javascript" src="http://code.jquery.com/jquery-1.5.2.min.js"></script>
<script language="Javascript">
$(document).ready(function() {
$('ie:menuitem[text*="new docs view"]').remove();
});
</script>
</code></pre>
<p>but it doesn't really work.</p>
|
javascript jquery
|
[3, 5]
|
3,010,720 | 3,010,721 |
global variable in jquery
|
<p>In jQuery is it possible to create a function that sets a variable which I can then access in another function. i.e. I need a global variable that can be accessed anywhere on the page. </p>
<p>Examples</p>
<pre><code>$.fn.getRedemptionID = function(){
var myVar = data.DATA[0].item1;
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,299,788 | 2,299,789 |
How to stream music in aspx
|
<p>I'd like to stream music with aspx, but i dont know how to start!
My general idea is that users, can have their one playlists, and upload their musics, but i dont know how can they hear their own musics trough the website.
The second idea is that the most voted playlist is streamed online for the people who want to hear!</p>
|
c# jquery asp.net
|
[0, 5, 9]
|
1,661,564 | 1,661,565 |
How to add native project and use native function in other c++ project
|
<p>I am working on android project.I have created a native edittext.I want use native jni function
in other android c++ project for display the edittext in c++.whenever i add the headerfile of
jni and edittext,then compiler does not find.</p>
<p>Can you suggest me.how to add native edittext project with my own project and how to use jni function with c++.
Your suggestion will helpful.</p>
|
android c++
|
[4, 6]
|
2,366,367 | 2,366,368 |
Getting information from the cookie made by FormsAuthentication.RedirectFromLoginPage in C#
|
<p>Hi I used this in C#:</p>
<pre><code>FormsAuthentication.RedirectFromLoginPage(userID, chkPersistCookie.Checked)
</code></pre>
<p>to create a cookie for my web app. </p>
<p>I need to know how to get the userID back from the cookie?</p>
|
c# asp.net
|
[0, 9]
|
3,020,917 | 3,020,918 |
Javascript + jQuery, click handler returning false to stop browser from following link
|
<p>I'm trying to stop the browser from following certain links, rather I want to unhide some Divs when they are clicked.</p>
<p>I'm having trouble just getting the links to not be followed though. </p>
<p>Here's what I have:</p>
<p><code>var titles = $('a.highlight');
jquery.each(titles, function(){
this.click(function(){
return false;
}
)
}
);</code></p>
<p>It seems like the click handler is not being assigned. What am I missing?</p>
|
javascript jquery
|
[3, 5]
|
5,407,940 | 5,407,941 |
jQuery - Select children with $(this)
|
<p>I try to count the number of children inside a div using jquery <code>$(this)</code> selector and the element's class. And the results are different. I thought jquery's <code>$(this)</code> refers to the owner object of function, is there any thing special about <code>$(this)</code> that I am missing? </p>
<pre><code>$('.parent').ready(function(){
$('.parent').children().length; // 6
$(this).children().length; // 1
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,704,650 | 2,704,651 |
Create a fileDownloadCompleted event and Handling it?
|
<p>I've got the task to develop a Chat App using Android, things sent between users are Text and Images, when User1 sends User2 an Image File, User2 has to first accept the request, and then file will be sent.</p>
<p>My Problem is, when User2 accepts the File Send Request, I still need to somehow know, that File Download has completed, to view the Image, how can I do that.</p>
<p>Is there an already defined Event in Android or Java, that I can listen to and Handle upon fileDownlaodCompletion? I appreciate help of any kind.</p>
|
java android
|
[1, 4]
|
2,334,600 | 2,334,601 |
How can I create an array out of something like $("li").text()
|
<p>Suppose I want to get all text of each <code>li</code> and save it into an array, how might I do that. </p>
<p>For example, something like ... </p>
<pre><code><ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
<li>6</li>
<li>7</li>
<li>8</li>
<li>9</li>
<li>10</li>
</ul>
</code></pre>
<p>should give me an array like</p>
<pre><code>["1", "2", "3", ..., "10"]
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,237 | 5,238 |
Upload and resize image in Aspx
|
<p>I have a page which allows the user to upload pictures. The problem is that my old users can't resize the image themselves. I want to allow them to upload any size of image and then when the server gets it, it will create a small copy of this picture.</p>
|
c# asp.net
|
[0, 9]
|
2,761,618 | 2,761,619 |
How to open just one instance of my application
|
<p>I found around this code</p>
<pre><code>android:launchMode="singleTask"
</code></pre>
<p>and it's working but when I open another instance of my application the old one is deleted and the new one is created, I would like the old one to stay alive and the new one will just turn to the old one.</p>
|
java android
|
[1, 4]
|
2,477,926 | 2,477,927 |
How do you structure your jQuery code?
|
<p>Coming from mootools and JAVA, mootools class implementation is a real nice way to structure my code, plus I can have some nice features like extending, implementing and so on. Starting with jquery I found my self writing $.fn plugins that cant use code of other plugins. Plus it seems no good idea to use the plugin structure for complex stuff that hasn't much to do with DOM Elements. Is there a better way then $.fn? What do you recommend to structure my code using jquery.</p>
|
javascript jquery
|
[3, 5]
|
4,022,195 | 4,022,196 |
How to get values from dynamically added (using javascript) elements?
|
<p>On my aspx page I dynamically create html controls on client side using javascript. For example, after page load you can click button in a browser, by clicking button html <em>input</em> and <em>select</em> elements appear. You may click once again, and this elements (<em>input</em> and <em>select</em>) will added again. So, you can create so many inputs and selects as you want (all this using javascript, no postbacks)</p>
<p>After user created some inputs and selects and entered some information in it, he posted form. I want on server side to find all this dynamically added elements and perform some actions depends on values in this controls. </p>
<p>How can I find dynamically added elements, and what is the best and elegant way to achieve this?</p>
<p>Thanks in advance.</p>
|
javascript asp.net
|
[3, 9]
|
3,105,111 | 3,105,112 |
How can I edit JS from browser?
|
<p>Suppose I get, on a page, this simple html/script :</p>
<pre><code><a id="hey" href="#">try</a>
var myvar=false;
$('#hey').click(function () {
if(myvar)
{
alert("Well! You change it!");
}
});
</code></pre>
<p>clicking on the link, I won't never get the alert show up! So, how can I edit JS (changing <code>myvar=true;</code>) on browser? I use Firebug... I need these details to test a security-side of my own application.</p>
|
javascript jquery
|
[3, 5]
|
1,321,874 | 1,321,875 |
Add Html to Text without children element
|
<p>I am very confused on how to get this work, did a lot of research online to help find a solution to this, but got nothing. Found this link here: <a href="http://viralpatel.net/blogs/jquery-get-text-element-without-child-element/" rel="nofollow">http://viralpatel.net/blogs/jquery-get-text-element-without-child-element/</a> but still didnt help much</p>
<p>This is what I am trying to accomplish, the system is outputting text like this, I have no control over the html.</p>
<pre><code><div class="myclass">
Text 1
Text 2
Text 3
</div>`
</code></pre>
<p>but would like to use jquery to insert html around those text
For example:</p>
<pre><code><div class="myclass">
<span>Text 1 </span>
<span> Text 2 </span>
<span> Text 3</span>
</div>
</code></pre>
<p>any help is appreciated</p>
<p>thank you very much</p>
|
javascript jquery
|
[3, 5]
|
3,937,043 | 3,937,044 |
javascript return function's data as a file
|
<p>I have a function in javascript called <code>"dumpData"</code> which I call from a button on an html page as <code>**onlick="dumpData(dbControl);"*</code> What it does is return an xml file of the settings (to an alert box right now). I want to return it to the user as a file download. Is there a way to create a button when click will open a file download box and ask the user to save or open it? (sorta of like right-clicking and save target as)...</p>
<p>Or can it be sent to a php file and use <code>export();?</code> Not sure how I would send a long string like that to php and have it simple send it back as a file download.</p>
<p>Dennis</p>
|
php javascript
|
[2, 3]
|
597,704 | 597,705 |
Intrigation Google+ to android tutorial?
|
<p>I want to post status in Google+ from android application.
I have downloaded the following jar file..
"google-api-services-plus-v1-rev16-1.7.1-beta"
Can any one provide any tutorial or instruction to add Google plus sdk to android?</p>
|
java android
|
[1, 4]
|
4,689,265 | 4,689,266 |
Getter function with switch case?
|
<pre><code>public User getByField(string field, string stringToFilter)
{
string fieldToReturn;
switch (field)
{
case "id":
fieldToReturn = "u.pk_user_id";
break;
case "username":
fieldToReturn = "u.user_username";
break;
}
var result = (from u in dc.Users
where fieldToReturn == stringToFilter
select fieldToReturn).Single();
return result;
}
</code></pre>
<p>I am trying to create one getter for all my fields using a switch case, because otherwise I would have to create a lot of setters (There are more cases than displayed here). But when I try to return the result, it says it is a String, rather than a User. I suppose it is because I am using a String in the LINQ-query, but I've tried solving it but can't figure it out how to do.</p>
|
c# asp.net
|
[0, 9]
|
531,503 | 531,504 |
jquery selects returning undefined value - asp.net webform
|
<p>simple bit of jquery. I have a div with clss linklist, inside it has several linkbuttons</p>
<pre><code><script type="text/javascript">
$(function () {
$('#linklist a').each(function () {
alert(this.text);
});
});
</script>
</code></pre>
<p>I would assume that it should alert the text inside each rendered hyperlink. instead I am getting the value "undefined"</p>
<p>if i change it to </p>
<pre><code>alert(this.id);
</code></pre>
<p>i am getting the correct client id - therefore i know at least that I am selecting correct.
why is this value undefined? same goes for this.text and this.value</p>
<p>Thanks</p>
|
jquery asp.net
|
[5, 9]
|
5,177,209 | 5,177,210 |
First data global gateway webservice API Integration gives error in asp.net
|
<p>I have faced a problem on adding the webservice as web reference in vs10 to a project. The Webservice url is "https://ws.merchanttest.firstdataglobalgateway.com/fdggwsapi/services/order.wsdl"
I have installed all the necessary files to my system and iis(windows xp-2003 sp2, X64 version).
When i am trying to add this webservice it displays a blank page "This program cannot display the webpage" not the method lists.</p>
<p>"There was an error downloading 'https://ws.merchanttest.firstdataglobalgateway.com/fdggwsapi/services/order.wsdl'.
The underlying connection was closed: An unexpected error occurred on a receive.
The decryption operation failed, see inner exception.
The message received was unexpected or badly fo"</p>
|
c# asp.net
|
[0, 9]
|
4,295,851 | 4,295,852 |
What's wrong with this syntax for getting length of longest row in table?
|
<p>I have a table that is populated from a JSON object. The result is a table with an uneven number of cells in each row. I'm working on a script to automatically append empty cells to each row so that there is a uniform number. My problem is figuring out the length of the longest row in the table. Below is my attempt at this. However, I keep getting errors that the row is undedefined (e.g. "cannot read property length of undefined"). What have I done wrong?</p>
<pre><code>function countCells() {
var columnCount;
$("#MarketsTable tr").each(function () {
columnCount = Math.max(columnCount, $(this).cells.length);
})
return columnCount;
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,075,632 | 3,075,633 |
Get alert if all they(ul) are empty
|
<p>How can done if all tags ul in <code>.empty</code> is empty alert ok?(with jQuery)</p>
<p><strong>EXAMPLE:</strong> <a href="http://jsfiddle.net/pqgGr/" rel="nofollow">http://jsfiddle.net/pqgGr/</a></p>
<pre><code><div class="empty">
<ul>1</ul>
<ul></ul>
<ul></ul>
</div>
if ($('.empty ul').is(":empty")) {
alert('ok')
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
2,527,083 | 2,527,084 |
How to handle problem with Network Connectivity in Java
|
<p>I have a simple java code which gets html text from the input url:</p>
<pre><code>try {
URL url = new URL("www.abc.com");
// Get the response
BufferedReader rd = new BufferedReader(new InputStreamReader(url.openStream()));
while ((line = rd.readLine()) != null) {
String code = code + line;
} catch (IOException e){}
</code></pre>
<p>I am using this code in an android project. Now the problem comes when there is no internet connectivity. The application just halts and later gives error.</p>
<p>Is there some way to break this after some fixed timeout, or even return some specific string after an exception is thrown. Can you please tell me how to do that??</p>
|
java android
|
[1, 4]
|
1,687,213 | 1,687,214 |
jQuery: Check for existence of BR as first or last element, including text nodes within a paragraph
|
<p>I wish to test in jQuery for the existence of a <code><br /></code> as the very first, or very last element (including text nodes) within a paragraph. The 2 examples below would be true:</p>
<pre>
<code>
<p>
<br />
Lorem ipsum dolor sit amet consectetur, adiscipling elit.
</p>
</code>
</pre>
<pre>
<code>
<p>
Lorem ipsum dolor sit amet consectetur, adiscipling elit.
<br />
</p>
</code>
</pre>
<p>While this example would be false:</p>
<pre>
<code>
<!-- This is false -->
<p>
Lorem ipsum dolor sit amet consectetur, adiscipling elit
<br />
Lorem ipsum dolor sit amet consectetur, adiscipling elit.
</p>
</code>
</pre>
<p>If true, the following <code>class</code>’s of <code>diog-fail brbr</code> are to be applied to the containing paragraph element.</p>
|
javascript jquery
|
[3, 5]
|
5,303,790 | 5,303,791 |
On button click load UserControl without refreshing whole page
|
<p>Explaining my problem: </p>
<p>In my ASP.NET solution i have 2 buttons:</p>
<p>Button 1 and Button 2 </p>
<p>I have two UserControls with totally different content</p>
<p>OnClick of each of those buttons i want to load different UserControl into ContentPlaceHolder, but without reload whole page. So actually it have to work like Ajax TabContainer (but without loading all tabs at once). </p>
<p>I have tried to solve this problem with Ajax TabContainers, but loading times was just awful.</p>
<p>Anyone had same problem? How do u solve this one guys? </p>
|
c# jquery asp.net
|
[0, 5, 9]
|
5,455,391 | 5,455,392 |
Have a child window be notified when parent window goes to a different page?
|
<p>i have a parent window and a child window. in javascript, i want a function in child window to be called whenever the parent window loads a new page. i'd like to use something similar to jQuery's $(document).ready() so that I don't have to worry about whether the parent is done loading yet - but ready() only appears to fire when the window loads the <em>first</em> page - but not when, say, a link is clicked in the parent and it loads a <em>second</em> page.</p>
<p>any suggestions? thanks.</p>
|
javascript jquery
|
[3, 5]
|
5,864,201 | 5,864,202 |
Jquery keyup issue with dropdown menus?
|
<p>I have this code, basically I have <code><input id="register_username" type="text" name="username"></code> and I want to check if the users already exist in the database or not. The code works perfectly when the user type a username, but sometimes some browsers (for example Firefox) gives the user drop down menu and let them choose some values they already entered in the past (such as their name). The problem is when the chose the username from the drop down menu, the <code>keyup</code> function does not work. How can I fix this problem ?</p>
<pre><code>$("#register_username").live('keyup', function() {
$.post('scripts/register/register_check.php', {
checkusername: $('#register_username').val()
}, function(data) {
if (data == "good") {
//do something
} else {
//do the other thing
}
});
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
5,201,174 | 5,201,175 |
How to populate <tbody> with dynamic generated JavaScript?
|
<p>I get some Json response with a list of objects.</p>
<pre><code> onComplete: function (id, fileName, responseJSON) {
// alert(responseJSON[0].Image);
}
</code></pre>
<p>How I can populate <code><tbody></code> with dynamic generated JavaScript and include JSON data?</p>
<p>Any sample brothers!!</p>
<p>Thank you in advance guys!</p>
<p>UPDATES:</p>
<p>The final solution is here</p>
<pre><code> function genTable(data) {
var contentData = '';
$.each(data, function (i, user) {
contentData += "<tr><td>" + user.Image + "</td><td>" + user.Title + "</td></tr>";
});
$("#ImageList").html(contentData);
}
</code></pre>
|
javascript jquery
|
[3, 5]
|
3,089,444 | 3,089,445 |
replace spaces with commas with javascript
|
<p>I have a string with keywords and I need to check if this string contains spaces and if yes replace them with commas.<br>
the string can be something like "keyword1 keyword2 ,keyword3 keyword4,keyword5"<br>
or any other combination of spaces and commas.
the final result should be a string of keywords separated by commas without any spacing<br> like in the following <strong>"keyword1,keyword2,keyword3,keyword4,keyword5"</strong>.<br>
for that I tried to do <code>$("#strId").split('').join(',')</code><br>
This done the job but I notice that if I have a string which contains more then one space between each keyword I got multiple commas like that:<br>
original string=(keyword1 keyword2 keyword3)<br>
result string =(keyword1,,,,,,keyword2,,,,,,keyword3)<br>
and I need that it will be with single comma only between each word.
I will appreciate a help on this issue</p>
<p>Thanks </p>
|
javascript jquery
|
[3, 5]
|
1,418,811 | 1,418,812 |
Reusable Method to change gridview cell colour
|
<p>I need to change the colour of gridview cells based on the data value. I can quite easily do this using a datarow view in the Gridviews RowDataBound Event and an if statement (see below), however I need to do this on 30 columns which will be rather long winded and a pain to change if the business rules change. How can I encapsulate the following into a reusable method that I can call and just pass in the data column and the cell index ?</p>
<pre><code> protected void gv1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.DataItem != null)
{
DataRowView drv = (DataRowView)e.Row.DataItem;
int A = Int32.Parse(drv["A"].ToString());
if (A <= 74)
{
e.Row.Cells[2].BackColor = System.Drawing.Color.Red;
}
}
}
</code></pre>
|
c# asp.net
|
[0, 9]
|
1,396,854 | 1,396,855 |
Using .Split() then adding these values to 3 php variables
|
<p>I have used this code on an autosuggest script to split the CSV created into 3 values in an array as such:</p>
<pre><code><?php if($_POST['category_submit']){ ?>
<script type="text/javascript">
$(document).ready(function() {
var arr = $(".as-values").val().split(",");
var category_1=arr[0];
var category_2=arr[1];
var category_3=arr[2];
});
</script>
<?php } ?>
</code></pre>
<p>I now want to add the 3 values within the 3 'var' into the mysql database. What would be the steps necessary to do so? </p>
<p>Many thanks in advanced.
Ben.</p>
|
php jquery
|
[2, 5]
|
4,858,730 | 4,858,731 |
Making dynamic sized boxes
|
<p>I have a quiz that have four options to choose.
Every question have different options and sometimes an option have a long text that doesn't fit in my fixed size boxes (say <code>div</code>).
I don't want to have largest possible box to prevent overflow in my boxes. I want to size my box depended on longest option that I have in current quiz and if every option is short enough use fixed sizes that I had.</p>
<p>this is my HTML markup:</p>
<pre><code><div id="options">
<div class="option 1">
<span class="optiontText"></span>
</div>
<div class="option 2">
<span class="optiontText"></span>
</div>
<div class="option 3">
<span class="optiontText"></span>
</div>
<div class="option 4">
<span class="optiontText"></span>
</div>
</div>
</code></pre>
<p>and this is CSS:</p>
<pre><code>#options{ width:800px;}
.option{width:380px; margin:10px;}
</code></pre>
<p>Text of optionTexts came from database and I want a jQuery function that size my boxes depended on size of text</p>
|
javascript jquery
|
[3, 5]
|
1,775,473 | 1,775,474 |
Access outer variables inside dispatchMessage
|
<p>I'm dealing with legacy code. My task is to process the result of an async task.</p>
<p>I'm stuck with getting access to outer objects inside dispatchMessage method. Are there any means achieve it or should I use Singleton or static properties ? </p>
<p>So far I've made a class responsible for running in asynchronous mode.</p>
<pre><code>private class BackgroundTask extends AsyncTask<Object, Void, Boolean>
{
@Override
protected Boolean doInBackground(Object... params){
// ...
}
@Override
protected void onPostExecute(Boolean result){
// ...
}
}
</code></pre>
<p>Inside the OnPostExecute or the doInBackground method I'd like to send a message using a handler, so I push in some simple stuff:</p>
<pre><code>Message m = new Message();
Bundle b = new Bundle();
b.putString("sizeKEY", "size " + _count);
m.setData(b);
_handler.sendMessage(m);
</code></pre>
<p>And I need to access outer objects right here:</p>
<pre><code>new Handler(){
@Override
public void dispatchMessage(Message msg) {
super.dispatchMessage(msg);
// get access to, say, Activity property or method here
}
}
</code></pre>
<p>How is it done ?</p>
|
java android
|
[1, 4]
|
3,286,711 | 3,286,712 |
Dynamic text box list
|
<p>I am trying to make a text box list using jquery. What I want is to have text that changes into a textbox when clicked. Then I want it to return to text afterwords. My problem is getting the dynamically created textboxes to focus, change the textbox text, be removed and change the text. This is my code:</p>
<pre><code>$('.l').click(function() {
$('<input type="text" id="ltb" class="'+$(this).attr("class")+'">').insertAfter($(this)).val($(this).val());
$('#ltb').focus();
$(this).remove();
})
$('#ltb').blur(function() {
$('<div id="'+$(this).attr("class")+'" class="l">'+$(this).val()+'</div>').insertAfter($(this));
$(this).remove();
});
</code></pre>
<p>.l is the text while #ltb is the textbox. I need the #ltb to change value, focus, and be removed. I need .l to change once #ltb is removed. Can someone tell me how to do this?</p>
|
javascript jquery
|
[3, 5]
|
1,599,534 | 1,599,535 |
Retrieve JSON data from a hidden input
|
<p>I store JSON data in HTML hidden fields on the server side. Then I'd like to retrieve that data using Javascript and JQuery on the client side. The problem is that I get a JSON string instead of a JSON object.</p>
<p>This is my code on the server side:</p>
<pre><code><form id="data" style="display: none;">
<input id="channels" type="hidden" tal:attributes="value python: view.context['ChannelManager'].toJSON(view.channels.values())" />
<input id="mediaGroups" type="hidden" tal:attributes="value python: view.context['MediaGroupManager'].toJSON(view.mediaGroups.values())" />
</form>
</code></pre>
<p>This is my code on the client side:</p>
<pre><code>copy.channelList = new ChannelTest();
copy.channelList.fromJSONObjectAll($("#data input[id=channels]").val())
</code></pre>
<p>So I get JSON string instead of JSON object from this, $("#data input[id=channels]").val().</p>
<p>How could I get JSON object without converting JSON string in JSON object?</p>
<p>Thanks in advance!</p>
|
javascript jquery
|
[3, 5]
|
5,835,300 | 5,835,301 |
Why is typeof my variable an object, and not a number
|
<p>I have a table which has a couple cells that contain simple numbers (IE: 1.00, 1000.00, 10000.00). I'm trying to format the cell contents using the 'format' function below. I have had success with this function in a different area of my code, but for whatever reason (the reason why I'm here) when I try to feed the contents of the table cells in, it doesn't work as I expected. </p>
<p>The problem is that the typeof my cell contents is 'object' and not 'number', so it skates right by the if statement and just returns my original value back to me. Is there a way I can coerce the data to be typeof number? I thought <code>var n = new Number(cellText);</code> would do the trick, however, the typeof comes back as object. Confused. </p>
<p>In globalize.js: </p>
<pre><code>Globalize.format = function( value, format, cultureSelector ) {
culture = this.findClosestCulture( cultureSelector );
if ( value instanceof Date ) {
value = formatDate( value, format, culture );
}
else if ( typeof value === "number" ) {
value = formatNumber( value, format, culture );
}
return value;
};
</code></pre>
<p>In my page: </p>
<pre><code>$(document).ready(function () {
$('td[globalize="true"]').each(function () {
var $this = $(this);
var cellText = $this.text();
if (cellText != null) {
var n = new Number(cellText);
var v = Globalize.formatNumber(n, _gloNum[0]);
$this.text(v);
}
})
});
</code></pre>
|
javascript jquery
|
[3, 5]
|
14,953 | 14,954 |
How to alter the Browser's Refresh Event and trigger a custom function?
|
<p>As you all know, when we hit the refresh button, the entire page starts to reload. But I dont that, I only want to refresh some portions, which need to be refresh in case of a need. </p>
<p>I know, I can use ajax to reload a piece of content. But I want to attach this ajax function while the user clicks the refresh button or presses F5 or presses Ctrl+F5.</p>
|
javascript jquery
|
[3, 5]
|
892,721 | 892,722 |
Android Button Onclick
|
<p>OK i'm new to android dev's and java so im having problems with on click method heres my code i know ive gotta be close thanks in advance all i want my button to do is when its clicked on the phone to swith the layout view from main.xml to xx.xml</p>
<pre><code> package my.project;
import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
public class ExperiencerlActivity extends Activity {
/** Called when the activ`enter code here`ity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Button button = (Button) findViewById(R.id.button1);
button.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
}
});
}
}
Here is my button code
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_above="@+id/linearLayout1"
android:layout_centerHorizontal="true"
android:layout_marginBottom="56dp"
android:onClick="setLogin"
android:text="Login" />
</code></pre>
|
java android
|
[1, 4]
|
4,029,694 | 4,029,695 |
Advice needed from experts about ASP.NET UserControl usage
|
<p>I need some advice here. I have a bunch of 10 products and every product has <strong>atleast 200 different pages</strong> associated with it, with varying details about the product. That makes around 2000 pages. </p>
<p>The structure of each page is as follows:</p>
<p>**Product Name<br>
Details About the product ( 500 words or more)</p>
<p>ProductImage | PurchaseDetails**</p>
<p>When a product page loads, I have to read the productname and display a box at the end of the page. This box should pick up an Productimage and PurchaseDetails that corresponds to the productname. For eg: if there is a product called 'AceShampoo', there is an image associated with it called 'aceshampoo.jpg'. Now I cannot read either the image or the description from the database, since it is not stored there. Only the ProductName and Details come from the DB.</p>
<p>My question to experts:</p>
<p>How and where do I store the ProductImage and the PurchaseDetails for fastest and best performance. Also since there are around 200 pages associated with each product, I would want a way where I can cache this and depending on the parameter i.e productname, change the values.</p>
<p><strong>Update:</strong> Some products do not have an image or purchase details. So I want to display no details or rather not show it to the users.</p>
<p>How do I go about it. A sample code with explanation would help this novice understand it better.</p>
<p>Thank you for reading this post.</p>
|
c# asp.net
|
[0, 9]
|
2,453,097 | 2,453,098 |
Replace first occurance in class
|
<pre><code><div class="section truck edit-track truck-army truck-ambulance"></div>
</code></pre>
<p>How do I replace only first <code>truck</code> to <code>truck garage-active</code>?</p>
<p>We should get this:</p>
<pre><code><div class="section truck garage-active edit-track truck-army truck-ambulance"></div>
</code></pre>
<p>Not this:</p>
<pre><code><div class="section truck edit-track truck-army truck-ambulance garage-active"></div>
</code></pre>
<p>jQuery <code>.addClass()</code> just adds a new class to the end of the class name, so it doesn't help - <a href="http://jsfiddle.net/xxbnt/" rel="nofollow">http://jsfiddle.net/xxbnt/</a></p>
<p>Need this for the right <strong>CSS class chaining</strong> styles.</p>
|
javascript jquery
|
[3, 5]
|
3,625,756 | 3,625,757 |
How to access repeater items from JavaScript
|
<p>I've got a hidden control inside a repeater. How can I access this from JavaScript?</p>
|
c# asp.net
|
[0, 9]
|
3,271,953 | 3,271,954 |
Add class active to the <li> tag
|
<p>I want to add class active to the <code><li></code> whenever specific url is accessed?</p>
<p>my code look like this,</p>
<pre><code><ul>
<li>
<a href="link1">Link1</a>
</li>
<li>
<a href="link2">Link2</a>
</li>
<li>
<a href="link3">Link3</a>
</li>
<li>
<a href="link4">Link4</a>
</li>
<li>
<a href="link5">Link5</a>
</li>
<li>
<a href="link6">Link6</a>
</li>
</ul>
</code></pre>
<p>if www.abc/link1 is is present in the url then only 1st li should be active and rest of them should not have any class.</p>
<p>Thnks in advance</p>
|
php javascript
|
[2, 3]
|
772,593 | 772,594 |
How to set up a "settimeout" properly for a jQuery function?
|
<p>I hope I can get some help. I'm new to Jquery and JavaScript and I got stuck with a "setTimeout" function.
I'm working on my navigation bar and basically I need a div(sub menu) to fade in when "click" on an anchor tag, fade it out if you move the mouse to a different navigation link and hide it all together if the mouse leaves it: like so:</p>
<ol>
<li><p>show on click but hide it after a couple of seconds</p></li>
<li><p>hide if after the mouse leaves the div.</p></li>
</ol>
<p>This is what I've got so far:</p>
<pre><code>$("a").click(function() {
$("#sub_nav").fadeIn(400);
});
$("#sub_nav").mouseleave(function() {
$(this).fadeOut(0);
});
$("#sub_nav").mouseenter(function() {
if(this) {
$(this).show(0);
} else {
setTimeout(function() {
$(this).fadeOut(0);
}, 2000);
};
});
</code></pre>
<p>It works as expected except for the <code>setTimeout</code>.</p>
<p>Appreciate all the help I can get.</p>
|
javascript jquery
|
[3, 5]
|
2,427,200 | 2,427,201 |
read css file specific property
|
<p>I have a JSP page with jQuery included.</p>
<p>I have a CSS file with a good load of lines in, I would like to read some specific styles for a given element(eg: header/footer) from the external CSS file into my jsp page using jquery.</p>
|
javascript jquery
|
[3, 5]
|
4,212,350 | 4,212,351 |
How to offset window top 50%
|
<p><a href="http://jsfiddle.net/motocomdigital/dKDJz/6/" rel="nofollow">http://jsfiddle.net/motocomdigital/dKDJz/6/</a></p>
<p>I'm trying to fix position a div to top 50% off my window height. Which I can do fine with CSS.</p>
<p>But the original position of this 'div.slider-button' is absolute positioned further down the page. But as the page scrolls down, and when the 'div.slider-button' reaches the 50% offset top position, my <code>.fixed</code> class should be added.</p>
<p>Currently my script below, adds the <code>.fixed</code> class when my div reaches window top position.</p>
<p>I need the script to add my <code>.fixed</code> class when my 'div.slider-button' reaches 50% of the window height.</p>
<pre><code>var $window = $(window),
$button = $(".slider-button"),
offsetbut = $button.offset();
$window.scroll(function() {
if ($window.scrollTop() > offsetbut.top ) {
$button.addClass('fixed');
} else {
$button.removeClass('fixed');
}
});
</code></pre>
<p><br /> </p>
<pre><code>.fixed {
position: fixed !important;
top: 50% !important;
}
</code></pre>
<p>See jsfiddle here <a href="http://jsfiddle.net/motocomdigital/dKDJz/6/" rel="nofollow">http://jsfiddle.net/motocomdigital/dKDJz/6/</a></p>
<p>You can see when the arrow reaches the top, it snaps to the middle, the arrow just needs to reache the middle of the window and stick.</p>
|
javascript jquery
|
[3, 5]
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.