Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
2,278,610
2,278,611
Strange behavior checking for Web Storage availability
<p>Here's my code:</p> <pre><code>if(typeof(Storage)!==undefined) { // Web storage support if(localStorage.hashes != "") { var hashes = jQuery.parseJSON(localStorage.hashes); for (var i = 0; i &lt; hashes.length; i++) { // Do stuff here } } else { var hashes = []; } } else { // No web storage support } </code></pre> <p>I don't really know what's going on, but when I try to load the page with this code from a device for the first time, the rest of my code doesn't work the way it should. However, if I comment it out then visit the page for the first time everything works. I can then uncomment it, reload the page, and everything will continue to work. This is really the best I can describe what's happening.</p>
javascript jquery
[3, 5]
621,025
621,026
Clean up dynamically loaded scripts
<p>I'm working on a dynamic web app and I ran across the following issue:</p> <p>Basically I have a single dynamic page managed by javascript, whose <code>&lt;div class="content"&gt;&lt;/div&gt;</code> is repopulated each time a user clicks a link in the navigation bar (dynamic load, no page change). The content that goes inside the <code>div</code> is a variable HTML chunk obtained from the backend (through a master servlet), based on the user's privileges.</p> <p>This generated content also includes several <code>script</code> tags which manage that content (i.e populate the initially empty elements with data from the server). They do not contain actual code, only references to .js files.</p> <p>The HTML is loaded inside the <code>div</code> through jQuery's <code>load</code> function, which executes the referenced scripts automatically.</p> <p>The problem arose when I wanted to debug one of the active scripts with Firebug, I noticed that all the scripts listed in the debugger (apart from the ones I declared on the master page) were listed as a simple number (e.g 10, 5, 33, etc), instead of their actual name, and that many of them were duplicates executing simultaneously, possibly from a previous page access.</p> <p>Is there any way I can clean up these obsolete scripts when I change the content? Possibly reference them at load time to be able to stop them?</p>
javascript jquery
[3, 5]
4,836,729
4,836,730
Jquery table row add stoping
<p>View link keeps adding rows to table upon each additional click. I need to stop ıt. I have 2 objects ın a JavaScript array, whıch ıs passed to prıntfeed functıon by GetVıewData. When I clıck on each vıew lınk It adds 2 rows, whıch ıs fıne. After clıckıng agaın ıt adds 2 more, and so on. How could I stop thıs functıonalıty?</p> <pre><code>$(document).ready(function() { $(".anch").click(function(e) { GetViewData(trID); }); function GetViewData(pid) { var data = [ {"FeedID":"10", "TranslateText": "test"}, {"FeedID":"11", "TranslateText": "test"}]; $.each(data, function (i, item) { printFeed(div, item,TableID ); }); function printFeed(div,item,tableName) { var iTableName = "#" + tableName; var newRow = $("&lt;tr&gt;&lt;td&gt;test&lt;/td&gt;&lt;/tr&gt;"); $(iTableName).append(newRow); } &lt;a class="anch"&gt;view&lt;/a&gt; &lt;div id="ajaxDiv-1"&gt; &lt;table id="Table2"&gt; &lt;tr&gt;&lt;td&gt;test&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; &lt;a class="anch"&gt;view&lt;/a&gt; &lt;div id="ajaxDiv-1"&gt; &lt;table id="Table3"&gt; &lt;tr&gt;&lt;td&gt;test&lt;/td&gt;&lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
3,833,025
3,833,026
How to do something with jquery after the DOM is ready but before the UI is rendered?
<p>I have a jQuery script that changes the src attribute of an <code>&lt;img&gt;</code> and a few other page elements. </p> <p>My script is hooked to the document-ready callback using <code>$()</code>. When I refresh the page I see the original content for half a second. I want to avoid that.</p> <p>Is there a way for my script to execute <strong>after</strong> the DOM is ready but <strong>before</strong> it is rendered?</p>
javascript jquery
[3, 5]
3,524,303
3,524,304
Cannot Send Post Request Jquery $.Post on Internet Explore 9 ActiveX Filtering
<p>I have a problem with Iexplore 9 ActiveX Filtering.</p> <p>I create an application which is set session through jquery $.post, when I turn on ActiveX filtering in Iexplore 9, it blocks the post request.</p> <pre><code>$('.sidid').click(function(){ val = $(this).val(); if ($(this).is(':checked')) { //when checked $.post("session_cetak_po.php", {"sidid":val}, function(results) { }); }else{ //when unchecked $.post("session_cetak_po.php", {"sidid":val,"unchecked":"1"}, function(results) { }); } }); </code></pre> <p>Any suggestion how to fix it?</p> <p>Thanks before :)</p>
php jquery
[2, 5]
910,051
910,052
Finding nth div of a certain class with .eq
<p>I have the following HTML</p> <pre><code>&lt;div id="MyDiv"&gt; &lt;div class="MyClass"&gt;test1&lt;/div&gt; &lt;div class="MyClass"&gt;test2&lt;/div&gt; &lt;div class="MyClass"&gt;test3&lt;/div&gt; &lt;div class="MyClass"&gt;test4&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I'm trying to use the jquery eq function and so far I have this:</p> <pre><code>function(TheIndex) { alert( ('.MyClass').eq(TheIndex).html() ); }; </code></pre> <p>I'm getting this error in Chrome</p> <p><strong>Uncaught TypeError: Object .MyClass has no method 'eq'</strong></p> <p>What am I doing wrong?</p> <p>Thanks for your suggestions.</p>
javascript jquery
[3, 5]
3,324,830
3,324,831
Get connection string from app.config
<p>I'm trying to make this simple call:</p> <pre><code>DataContext dc = new DataContext(ConfigurationManager.ConnectionStrings["MyDB"].ConnectionString) </code></pre> <p>And here's my app.config file:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;configuration&gt; &lt;connectionStrings&gt; &lt;add name="MyDB" connectionString="Server=STEVEN-PC;Database=MyDB;Trusted_Connection=yes;" /&gt; &lt;/connectionStrings&gt; &lt;/configuration&gt; </code></pre> <p>But I'm getting an error: <strong>Object reference not set to an instance of an object.</strong></p> <p>It can't find the connection string. What am I doing wrong?</p>
c# asp.net
[0, 9]
2,240,376
2,240,377
Asp.net duplicate form submissions on reload
<p>How do I prevent a form that is posted a second time because of a page reload in a browser from being added to my database again with C# Asp.Net.</p> <p>Thanks, Steven</p>
c# asp.net
[0, 9]
5,055,644
5,055,645
DomEvent AddHandler Issue
<p>I am having issue in my web application in asp.net. i am receiving the below error :</p> <blockquote> <p>Error: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.</p> </blockquote> <p>This issue occurs while trying to navigate to another page after opening and closing a popup div using the following jquery</p> <pre><code>$('#dlgPC').dialog({ modal: true, width: 1200, height: 300, zIndex: 100000 }); return false; </code></pre>
c# jquery asp.net
[0, 5, 9]
4,171,048
4,171,049
Java Script is not redirecting using window.location
<p>I am calling the js function from the href </p> <pre><code>function topicApproval() { var approve = confirm('Do you wish to proceed?'); if(approve) { window.location('http://www.sample.com'); } } </code></pre> <p>Here is the function called Yes</p> <p>But it is not redirecting........ Please help me..</p>
php javascript
[2, 3]
5,499,493
5,499,494
jQuery equivalent to [function].parameters from javascript
<p>I've had this javascript function that I've used many many times over ...</p> <pre><code>function showHideObjects() { var args; args = showHideObjects.arguments; for(var i=0;i&lt;args.length;i++) { if(document.getElementById(args[i])) { if(args[i+1] == 'flip') { if(document.getElementById(args[i]).style.display == '') { document.getElementById(args[i]).style.display = 'none';} else { document.getElementById(args[i]).style.display = '';} } else { document.getElementById(args[i]).style.display = args[i+1]; } } i++; } } </code></pre> <p>Now I'm working with ASP.NET and need that same function but in jQuery but I can't find any information about dynamic parameters in jQuery. Is there a way to do this in jQuery?</p> <p>To provide a little more background ... you could call the above code with a line like ... <code>showHideObjects('div1','none')</code> and it'd hide div1. Or you could call ... <code>showHideObjects('div1','none','div2','','div3','flip')</code> and it'd hide div1, show div2 and switch div3 from either hidden or shown.</p>
javascript jquery
[3, 5]
1,467,107
1,467,108
extending c# textbox control
<p>I am extending the textBox control, and i want to call a javascript function on its OnLoad(EventArgs e). how can i do this? </p> <pre><code>public partial class MyTextBox: TextBox { protected override void OnLoad(EventArgs e) { base.OnLoad(e); //call to a javascript function? } } </code></pre>
c# javascript
[0, 3]
2,711,554
2,711,555
How can I get a server-side control's tag?
<p>How can I get a server-side control's tag? I'm guessing it's something like below:</p> <pre><code>TextBox textBox=new TextBox(); GetTag(TextBox textBox) { ... } </code></pre> <p>And the result is something like <code>&lt;asp:TextBox /&gt;</code> (the control's design time tag).</p> <p>When I change the control to <code>CheckBox</code> then the result should be something like <code>&lt;asp:CheckBox /&gt;</code>.</p>
c# asp.net
[0, 9]
1,831,176
1,831,177
File upload progress bar: is flash-based the only way possible
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/653063/upload-progress-using-pure-php-ajax">Upload progress using pure PHP/AJAX?</a> </p> </blockquote> <p>I'm trying to have a file upload input field in my form and to have a status bar that shows upload progress as a percent and kb of the file. I keep seeing a lot of flash-based uploaders like swfupload. What non-flash alternatives are there that depend on js/jquery (no swf)</p>
php javascript jquery
[2, 3, 5]
1,809,264
1,809,265
How do I intercept emails?
<p>The stuff is obvious but not as simple. I need to build a simple as possible "automated email client" that will act as a reader for a certain email address: extracting attachments, inserting stuff into a database, interpreting content etc. My problem is, how to hook these emails, how to intercept them?</p> <p>I'd prefer java solutions/recommendations.</p> <p>Thanks</p>
c# java
[0, 1]
701,454
701,455
Two windows.onload on same page
<p>I have some external js scripts that i offer to my users to be embedded on their site. Individually they work fine, but if you try to append two in the same page one of them crash (no error on console). I think the problem have to be with calling windows.onload several times. </p> <p>Here how two embeded codes looks like:</p> <h2>Code 1</h2> <pre><code> &lt;script type="text/javascript" src="http://mysite.com/widget.js"&gt;&lt;/script&gt; &lt;p&gt;&lt;span class="punctis-social-widget"&gt;&lt;/span&gt;&lt;/p&gt; </code></pre> <h2>Code 2</h2> <pre><code> &lt;script type="text/javascript" src="http://mysite.com/poll.js"&gt;&lt;/script&gt; &lt;p&gt;&lt;span class="punctis-poll-button"&gt;&lt;/span&gt;&lt;/p&gt; </code></pre> <p>poll.js and widget.js are just two simple functions:</p> <p><strong>poll.js</strong></p> <pre><code>window.onload = function() { alert('IM POLL.js'); } </code></pre> <p><strong>widget.js</strong></p> <pre><code>window.onload = function() { alert('IM WIDGET.js'); } </code></pre> <p>One of this script will not load if you insert code 1 and code 2 in the same page. How can i solve this?</p>
javascript jquery
[3, 5]
3,454,805
3,454,806
Only Cyrillic input text form
<p>How do I restrict input text into a web form textbox only <strong>Cyrillic</strong> characters?</p>
javascript jquery
[3, 5]
5,090,793
5,090,794
define a web request for the specified URL
<p>what is the best way to validate a valid url and through error message?</p> <p>i am using something like this:</p> <pre><code> HttpWebRequest req = (HttpWebRequest)WebRequest.Create(url); </code></pre> <p>i am doing try and catch to catch the error message</p> <p>is that enough or can be do better then that?</p>
c# asp.net
[0, 9]
4,673,757
4,673,758
why is thread.join commonly used to stop threads in android
<p>looking at several android examples i see a trend where threads are paused using join() method:</p> <p>EDIT: please assume that the 2 threads are properly defined. edited the calls to join() </p> <pre><code>public class MainUI extends Activity{ private GraphicsViewThread g; private BackendDataViewThread b; void onCreate(){ g = new GraphicsViewThread(); g.start(); b = new BackendDataViewThread(); b.start(); } . . . void pauseGame(){ try { g.join(); }catch (InterruptedException e){ e.printStackTrace(); } try { b.join(); }catch (InterruptedException e){ e.printStackTrace(); } GraphicsViewThread = null; BackendDataViewThread = null; } } </code></pre> <ol> <li>which thread does GraphicsViewThread and BackendDataViewThread join to? </li> <li>what is the need for using join()? can i not set the references immediately to null?</li> </ol>
java android
[1, 4]
1,052,592
1,052,593
Play music one after each other
<p>I am working on a game in Android and i wanted to add a sort of playlist of music. I have about 10 music files and i want to be able to play the second one when the first one has finished and so on. Is there anyway to do this?</p>
java android
[1, 4]
1,663,405
1,663,406
Expertise in C#,java
<p>I am a novice in c#,java and i want to become Professional in both in 2 to 4 weeks.Can anyone please specify me the correct and exact way of achieving my goal.By exact way i mean,what practices to follow,what books to follow,what all available online resources best for me and what all projects to work on from novice to professional </p>
c# java
[0, 1]
4,716,512
4,716,513
Regex ReplaceAll Doesn't Work
<p>I copied this code from another StackOverflow post. However, I am having some issues with it. The items matching the pattern specified should be replaced but they are not.</p> <p>The code is:</p> <pre><code>protected String FixHexValuesInString(String str){ Log.v(TAG, "before fix: "+ str); Matcher matcher = Pattern.compile("\\\\x([0-9a-f]{2})").matcher(str); while (matcher.find()) { int codepoint = Integer.valueOf(matcher.group(1), 16); Log.v(TAG, "matcher group 0: " + matcher.group(0)); Log.v(TAG, "matcher group 1: " + matcher.group(1)); str = str.replaceAll(matcher.group(0), String.valueOf((char) codepoint)); } Log.v(TAG, " after fix: "+ str); return str; } </code></pre> <p>Here an example that I wrote to LogCat:</p> <pre><code>before fix: 'id': 1268, 'name': 'Reserva de Usos M\xfaltiples de la Cuenca del Lago de Atitl\xe1n-RUMCLA (Atitl\xe1n Watershed Multiple Use Reserve)' matcher group 0: \xfa matcher group 1: fa matcher group 0: \xe1 matcher group 1: e1 matcher group 0: \xe1 matcher group 1: e1 after fix: 'id': 1268, 'name': 'Reserva de Usos M\xfaltiples de la Cuenca del Lago de Atitl\xe1n-RUMCLA (Atitl\xe1n Watershed Multiple Use Reserve)' </code></pre> <p>Anybody see why this doesn't work?</p>
java android
[1, 4]
313,039
313,040
Modify contents in scrollable div keeping the position
<p>I have a div containing around 20 little divs inside, so that when you click on one, the big div is scrolled to center the small one; then its margins are increased. Problem is, when the margins are increased, the small div is pushed downwards, because the scroll position stays in the same place. I can fire another event to compensate the movement, but it doesn't look pretty, there's race conditions and the effects are no exact opposites.</p> <p>Is there a way to keep the div centered in the scroll and then push the neighbors away from it?</p>
javascript jquery
[3, 5]
2,637,357
2,637,358
php file_get_contents HTTP request failed! HTTP/1.1 401 on asp
<p>I'm trying get a content HTML from a page in asp with <code>file_get_contents</code>. When load page with browser, it works, no problem.</p> <p>To print status response I get 200 ok.</p> <pre><code>&lt;% Response.Write(Response.Status); %&gt; </code></pre> <p>But when I use <code>file_get_contents</code>, I get the error </p> <pre><code> HTTP request failed! HTTP/1.1 401 Unauthorized </code></pre> <p>if the cause from problem in firewall, is posible solved?? other can be cause from error?</p>
php asp.net
[2, 9]
4,109,046
4,109,047
jQuery Animate not working on Chrome
<p>I'm having a little issue here with Google Chrome. My code works pretty well with Safari, which makes me think it should work fine with Google Chrome. But Chrome doesn't animate as expected. What could be wrong?</p> <pre><code>$(function() { var sourceFoto = $(".empreendimento .main-photo img").attr("src"); var alturaFoto; var larguraFoto; var limiteX; var limiteY; $(document).load(sourceFoto, function() { alturaFoto = $(".empreendimento .main-photo img").height(); larguraFoto = $(".empreendimento .main-photo img").width(); limiteY = Math.round(alturaFoto - 420); limiteX = Math.round(larguraFoto - 580); $(".empreendimento .main-photo img").animate({ marginLeft: "-" + limiteX }, 5000, 'jswing').animate({ marginTop: "-" + limiteY }, 5000, 'jswing').animate({ marginLeft: "0px" }, 5000, 'jswing').animate({ marginTop: "0px" }, 5000, 'jswing'); }); });​ </code></pre> <p><strong>Edit</strong></p> <p>I've found the answer. Just loaded the image with <code>onLoad</code> method and worked pretty well.</p> <pre><code>image = new Image(); image.onload = function() { alturaFoto = $(".empreendimento .main-photo img").height(); larguraFoto = $(".empreendimento .main-photo img").width(); limiteY = Math.round(alturaFoto - 420); limiteX = Math.round(larguraFoto - 580); $(".empreendimento .main-photo img").animate({ marginLeft: "-" + limiteX }, 5000).animate({ marginTop: "-" + limiteY }, 5000).animate({ marginLeft: "0px" }, 5000).animate({ marginTop: "0px" }, 5000); } image.src = sourceFoto;​ </code></pre>
javascript jquery
[3, 5]
4,386,613
4,386,614
Expandable Listview Group Indicator half off screen?
<p>I am using a custom Group indicator as shown in the code below. Now if I leave the default I can use setBounds perfectly, but when using my custom image which is the same dimensions and setup as the same .9 patch file it is always half off screen. No matter what values I use for setBounds()</p> <pre><code> Drawable plus = (Drawable) getResources().getDrawable(R.drawable.expander_group); getExpandableListView().setGroupIndicator(plus); Display newDisplay = getWindowManager().getDefaultDisplay(); int width = newDisplay.getWidth(); getExpandableListView().setIndicatorBounds(0,0); </code></pre> <p>XML expander_group</p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_expanded="true" android:drawable="@drawable/minus" /&gt; &lt;item android:drawable="@drawable/plus" /&gt; &lt;/selector&gt; </code></pre> <p>EDIT:</p> <p>Interestingly. I have copied the exact xml and image files from the standard Android files. And when I use the above method to define it the exact same thing happens! So it is not the xml or image files that are causing the issue I think.</p> <p><img src="http://i.stack.imgur.com/GZD55.png" alt="enter image description here"></p>
java android
[1, 4]
3,970,099
3,970,100
Triggering a click for a control in a update panel problems
<p>I'm using a RadListView and i want to click a checkbox/button (It displays as a checkbox but its designer code shows it as a button). But every time i call the click method the page refreshes instead of updating the update panel which contains the list view.</p> <p>How do i call the click event without the page posting back instead of the update panel?</p> <pre><code> &lt;asp:Button ID="SelectButton" runat="server" CausesValidation="False" CommandName="Select" CssClass="rlvBSel" Text=" " ToolTip="Select" /&gt; </code></pre> <p>Code:</p> <pre><code> $(".rlvI, .rlvA").click(function () { $(this).find(".rlvBSel").click(); }); </code></pre>
jquery asp.net
[5, 9]
3,554,756
3,554,757
How to Create a Radio Button Dynamically with jQuery?
<p>I am developing a small application in which I want to create 20 radio buttons in one row.</p> <p>How can I do this using jQuery?</p>
javascript jquery
[3, 5]
1,416,453
1,416,454
How to use Google translate API from code
<p>I am trying to create an app that send a word to <em>translate.google.com</em>, take the result of the translation and display it to the user. I composed the URL but I do not know how to extract the word/phrase from the webpage. </p> <p>EXAMPLE PSUEDO en is code for english and es is code for spanish</p> <pre><code>String from = "en"; String to = "es"; String word = "hello"; //this will be user input text really String URL = "http://www.translate.google.com/#" + from + "/" + to + "/" + word; </code></pre> <p>Therefore the request URL will look like <a href="http://www.translate.google.com/#en/es/hello" rel="nofollow">http://www.translate.google.com/#en/es/hello</a></p> <p>I now need to be able to retrieve the information from the result box and place it in a String so I can display it to the user. </p>
java android
[1, 4]
1,083,978
1,083,979
vertical expand div
<p>I have two DIV</p> <p>one on the right the the other on the left side</p> <p>I'm looking for a code that give me link and by clicking on this link both divs will expand to 100% (mean that one of them will slide down) and by click again they will return back to be side by side</p> <p>Thanks in advanced</p> <p>I tried this:</p> <pre><code>&lt;style&gt; #container { width:100%; height:500px; } #left { width:45%; height:500px; float: left; } #right { width:45%; height:500px; float: left; } &lt;/style&gt; &lt;script type="text/javascript" src="scripts/jquery-1.8.0.min.js"&gt;&lt;/script&gt; &lt;div id="container"&gt; &lt;div id="left"&gt; LEFT &lt;/div&gt; &lt;div id="right"&gt; RIGHT &lt;/div&gt; &lt;/div&gt; &lt;script&gt; $('#container').click(function(){ if (parseInt($('div#right').css('right'),10) &lt; 0) { // Bring right-column back onto display $('div#right').animate({ right:'0%' }, 1000); $('div#left').animate({ width:'45%' }, 600); } else { // Animate column off display. $('div#right').animate({ right:'-45%' }, 600); $('div#left').animate({ width:'100%' }, 1000); } }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
3,350,529
3,350,530
help with NullReference exception in C#
<p>The following is a web method that is called from ajax, I have verified with firebug that the script is indeed passing two string values to my method:</p> <pre><code>public string DealerLogin_Click(string name, string pass) { string g="adf"; if (name == "w" &amp;&amp; pass == "w") { HttpContext.Current.Session["public"] = "pub"; g= "window.location = '/secure/Default.aspx'"; } return g; } </code></pre> <p>I'm passing "w" just for testing purposes. If I delete the if block then I don't get an error back from the server. I'm confused.</p>
c# asp.net
[0, 9]
87,940
87,941
Find dynamically added user control
<p>I have added user control dynamically. My intention is to find which other user controls are related to the clicked user control. </p> <p>Relationships between the <code>imagesButtons</code>(part of user control) in database. Just need to find the user control as whole or the <code>Code behind</code> values of the related imagebuttons so that I can find the related <code>ImageButtons</code> and do operations on them. Can I do it by using this?</p> <p>This is the code that am executing</p> <pre><code>Control c = (Page.LoadControl("Product_UserControl.ascx")); string id = (c.FindControl("imgBtn") as ImageButton).ID; </code></pre>
c# asp.net
[0, 9]
1,321,976
1,321,977
How to set default checkbox status with javascript?
<p>I am used to doing this in jQuery </p> <pre><code>$('#RememberMe').attr('checked', true); </code></pre> <p>but I can't remember how to do it in Javascript I thought that </p> <pre><code>document.getElementById("RememberMe").value = "True"; </code></pre> <p>would work, but it doesn't, it changes the value but does not create the visual check on the html.</p> <p>I am trying to set the checkbox to on by default. here is the html</p> <pre><code>&lt;input id="RememberMe" name="RememberMe" type="checkbox" value="false" /&gt; </code></pre>
javascript jquery
[3, 5]
1,277,865
1,277,866
Why isnt my jquery working when I use external pages
<p>Im using jquery to load in 2 external pages, one called search.php and the other is called info.php. I am displaying them each on a single page called user.php but only when there link has been clicked in the navigation bar. Unfortunately I am currently experiencing a problem, when I use this section of script:</p> <pre><code>$(document).ready(function() { $('#content_area').load($('.menu_top:first').attr('href')); }); $('.menu_top').click(function() { var href = $(this).attr('href'); $('#content_area').hide().load(href).fadeIn('normal'); return false; }); </code></pre> <p>My page seems to flicker and stall for 2 seconds before changing the content. I have noticed However if I remove the .hide and fadeIn it seems to work fine. How can I still use the fade-in but eliminate the stall and flickering?</p>
javascript jquery
[3, 5]
3,242,883
3,242,884
Detecting History Change using PHP?
<p>Here is what I would do in JavaScript. Is there any way to do it in php? I am working on a project that needs this functionality but cannot use JavaScript.</p> <pre><code>setInterval ( "checkHistory()", 1000 ); function checkHistory() { if (oldHistLength != history.length) { removegateway(); oldHistLength = history.length; } } </code></pre>
php javascript
[2, 3]
5,676,525
5,676,526
Pass var to a href
<p>I´m trying to pass the src of an image to an a href that is created via javascript.</p> <p>For example I have this <strong>var</strong>:</p> <pre><code>var src = $(img).attr('src'); </code></pre> <p>And I want to pass the <strong>src</strong> to the href in this modal (instead of the 'javascript:void(0)'):</p> <pre><code>_this.modal_zoom = $('&lt;a /&gt;', {'href' : 'javascript:void(0)' , 'class' : 'jqzoom'}) </code></pre> <p>How can I do it?</p>
javascript jquery
[3, 5]
4,194,744
4,194,745
ASP.NET bundle does not work when deployed (debug="false")
<p>In development bundling works as expected with uncombined and unminified files but after deploying a site with web.config set enable the bundles</p> <pre><code>&lt;compilation debug="false" targetFramework="4.5" /&gt; </code></pre> <p>the result of get a request to a bundle may include a comment at the top similar to the following</p> <pre><code>/* Minification failed. Returning unminified contents. .. errors like JS1002 or JSxxxx errors </code></pre> <p>In other cases no errors are thrown from minification but some javascripts fails to run or errors during execution.</p> <p>What syntax in otherwise working javascript might cause this behavior after bundling?</p>
javascript asp.net
[3, 9]
3,951,113
3,951,114
PHP to C#.NET/ASP.NET
<p>How to write this in C #? Can you use Dictionary to this?</p> <pre><code>$count = 0; if(count($_SESSION['goods']) &gt; 0) { $count = count($_SESSION['goods']) -1; // array start on zero. } $_SESSION['goods'][$count]["products_id"] = $_POST["products_id"]; $_SESSION['goods'][$count]["price"] = $_POST["price"]; $_SESSION['goods'][$count]["number"] = $_POST["number"]; </code></pre>
c# php
[0, 2]
3,973,003
3,973,004
Reset a view in an asp.net MultiView
<p>I'm using an asp.net MultiView control with 2 Views inside. First view has a "create" button to create new customer. Clicking the "create" button will display the 2nd View of the MultiView which allows to enter customer information. Second view has a "return" button to return back to the 1st view.</p> <p>The problem is: after creating the first customer, clicking the "create" button again will render the 2nd view with first customer's information already entered.</p> <p>Is there a way to reset 2nd view to its default state whenever the "create" button is clicked? Perhaps, clearing out the viewstate?</p> <p>Currently I'm using a recursive method to clear out all the inputs (textbox, radiobutton, dropdownlist, etc.). I just want to know if there's a cleaner/better way.</p> <p>Thanks</p>
c# asp.net
[0, 9]
2,836,267
2,836,268
Introduction to c# for c/c++ users
<p>I have 6+ years of c/c++ experience. Tomorrow starts a university assignment where I will have to use c#. Therefor I would like to have a list of links which you think important, an extensive tutorial - in short everything you think worthy.</p> <p>codingstyle, best practices, ...</p> <p>(I don't know any specifics about the c# environment I will be using(IDE, OS, w/e), the first meeting is tomorrow evening)</p> <p>(I have never coded c# before)</p> <p>One more thing: I would like to work using linux (kubuntu 10.4). IDE / environment / turorial suggestions regarding linux specifically are very welcome.</p> <p>thanks for your help!</p>
c# c++
[0, 6]
2,524,770
2,524,771
the 'Color Animations plugin' doesn't wokr on webkit(safari chrome)
<p>the Color Animations doesn't wokr on webkit(safari chrome)</p> <p><a href="http://plugins.jquery.com/project/color" rel="nofollow">http://plugins.jquery.com/project/color</a></p> <pre><code>&lt;script type="text/javascript" src="jquery.color.js"&gt;s&lt;/script&gt; $('#start').animate({ 'backgroundColor':'yellow' }, 1000,'linear', function() { }) </code></pre> <p>it is works well on firefox</p> <p>why ?</p> <p>thanks</p> <hr> <p>the answer is background,look next code</p> <p>and you will be find a is not run,and b is ok(in safari and chrome):</p> <pre><code>&lt;dl id=a style="width:100px;height:100px;"&gt; &lt;/dl&gt; &lt;dl id=b style="width:100px;height:100px;background:#fff"&gt; &lt;/dl&gt; &lt;script src="jquery-1.3.2.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="jquery.color.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $('#a,#b').animate({ backgroundColor: "orange" }, 1000) .animate({ backgroundColor: "yellow" }, 1000) .animate({ backgroundColor: "green" }, 1000) &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
4,438,793
4,438,794
Manipulating HTML from the asp.net code-behind
<p>I am able to get the HTML from the code-behind, like this one:</p> <pre><code>protected override void OnPreRenderComplete(EventArgs e) { StringWriter sw = new StringWriter(); base.Render(new HtmlTextWriter(sw)); sbHtml = sw.GetStringBuilder(); Response.Write(sbHtml + "&lt;!-- processed by code-behind --&gt;"); } </code></pre> <p>But I need to remove the HTML from the Page, any help?</p>
c# asp.net
[0, 9]
178,006
178,007
Increase ID number as a button is clicked in js
<p>I have a button each time it is clicked, a new select input will be added. But I want the id and name of the select changed as well.My codes was:</p> <pre><code>&lt;section&gt; &lt;div class="container"&gt; &lt;select id="myId_1" name="myName_1"&gt; &lt;option value="1"&gt;1&lt;/option&gt; &lt;option value="2"&gt;2&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; &lt;/section&gt; &lt;button type="button" id="myBtn"&gt;add&lt;/button&gt; $(document).ready(function () { $('#myBtn').click(function(){ var addEvent = $('.container').html(); var addEventCell = $('&lt;div class="container"&gt;'+addEvent+'&lt;/div&gt;'); $('section').append(addEventCell); }); }); </code></pre> <p>But my code just duplicates the id and name of select. I want it to change to myId_2, myName_2,myId_3,myName_3 and so on.</p> <p>I am new to javascript. It could be easy to you guys. Thanks for help !</p>
javascript jquery
[3, 5]
1,156,729
1,156,730
Will jquery live work for $('#somebutton').data('events').click?
<p>The events for a button get wired up after the page loads, so I need to use live for this.</p> <p>Will live work for this:</p> <pre><code>$('#somebutton').data('events').click; </code></pre>
javascript jquery
[3, 5]
3,862,298
3,862,299
Javascript: How to retrieve a value from a popup after a click event is fired
<p>I have a page where clicking on a link will open a popup window. The popup window will contain some value. Now when user clicks on a div tag, I want to copy the text of that div into a text box of the main window. </p> <p>I have used following code to open a popup - </p> <pre><code>popup = window.open(location, "popup","menubar=1,resizable=1,scrollbars=1,width=650,height=450"); </code></pre> <p>How can I do that?</p>
javascript jquery
[3, 5]
4,559,881
4,559,882
Move focus to a particular field
<p>I have a button that will add show a form on the page. how can I move the focus to the first field of the form when that button is clicked?</p> <p>simple example:</p> <p>HTML:</p> <pre><code>&lt;form style="display:none;" id="newForm"&gt; &lt;input type="text" id="firstField"&gt; &lt;/form&gt; &lt;input type="button" id="showForm" value="add new"&gt; </code></pre> <p>jQuery:</p> <pre><code> $("#showForm").click(function(){ $("#newForm").show(); //move focus?? }); </code></pre>
javascript jquery
[3, 5]
297,623
297,624
How can I retrieve all mouse coordinates between mousedown to mouseup event
<p>As per the jQuery docs below code can be used to capture mouseup and mouse down events. But my requirement is bit different</p> <pre><code>$("#dic").mouseup(function () { }).mousedown(function () { }); </code></pre> <p>But How can I calculate mouse moving co-ordinates between mousedown position to mouseup position. Please help me on this. How can I apply mousemove event between mousedown and mouseup</p>
javascript jquery
[3, 5]
5,534,084
5,534,085
How to remove all tags after certain tag?
<p>I need to remove tags going after <code>#first</code> and only in <code>#container</code>. How can I do it with jQuery?</p> <pre><code>&lt;div id="container"&gt; &lt;div id="first"&gt;&lt;/div&gt; &lt;div id="remove_me_1"&gt;&lt;/div&gt; &lt;div id="remove_me_2"&gt;&lt;/div&gt; &lt;div id="remove_me_3"&gt;&lt;/div&gt; &lt;a href="" id="remove_me_too"&gt;Remove me too&lt;/a&gt; &lt;/div&gt; </code></pre> <p>Thank you</p>
javascript jquery
[3, 5]
2,585,451
2,585,452
ASP.NET/Jquery: document ready in update panel?
<p>I have the following user-control:</p> <pre><code>&lt;%@ Control Language="C#" AutoEventWireup="true" CodeFile="FadingMessage.ascx.cs" Inherits="includes_FadingMessage" %&gt; &lt;asp:PlaceHolder Visible="false" runat="server" ID="plhMain"&gt; &lt;span id="&lt;%= this.ClientID+"_panel" %&gt;" style="background-color:yellow; padding:10px;"&gt; &lt;b&gt;&lt;%= Message %&gt;&lt;/b&gt; &lt;/span&gt; &lt;script type="text/javascript" language="javascript"&gt; $(document).ready(function() { alert("never gets here??"); jQuery('#&lt;%= this.ClientID+"_panel" %&gt;').fadeOut(1000); }); &lt;/script&gt; &lt;/asp:PlaceHolder&gt; </code></pre> <p>Which is used in an asp:UpdatePanel. My problem is that $(document).ready is never fired?</p> <p>How can I detect when a partial rendering has finished?</p>
c# asp.net jquery
[0, 9, 5]
2,552,209
2,552,210
How to write the code for self expiring download link for asp.net website?
<p>I am planning to sell digital goods on my website (Asp.net). After successful payment the customer will be redirected to the download page of my website, which will display the link to download the digital content stored in my server. </p> <p>I want to secure the location of the file, by creating a disposable link to the file. Every time a customer visits this page a new download link will be generated for the same file. Also this link should expire after it is downloaded for the first time. </p> <p>Is it possible to do it in asp.net ( C# preferably )? if yes how can i do it? </p>
c# asp.net
[0, 9]
4,502,396
4,502,397
How to rewrite this, so that it doesn't trigger a checkbox
<p>My problem is that on pageload a checkbox is triggered and because of this an ajax call is made which makes my page load very slowly. </p> <p>I have located the code that triggers these checkboxes:</p> <p><strong>My jQuery script</strong></p> <pre><code>$('.checkGroup &gt; input[type="checkbox"]').live('change',function(){ $t = $(this); $t.closest('.checkGroup').find('.payload').toggle( $t.is(':checked')); if( !$t.is(':checked') ){ $t.closest('.checkGroup').find('.payload input[type="checkbox"]') .attr('checked',false); } }).trigger('change'); $('.checkGroup input[type="checkbox"]').change(function(){ $c = $(this); $c.closest('.checkGroup').find('label &gt; span b') .text( $c.closest('.checkGroup') .find('input[type="checkbox"]:checked').length ); }).trigger('change'); </code></pre> <p><strong>How can I disable this onload or any other way?</strong></p>
javascript jquery
[3, 5]
2,476,096
2,476,097
Adding classes to LI with JQuery LI to every 7th item
<p>I am using this code to add a class to every 7th LI items and the first one too:</p> <pre><code>$('ul li:first, ul li:nth-child(7n)').addClass("first"); $('ul li:first, ul li:nth-child(1)').addClass("first"); </code></pre> <p>My problem is that it just adds the class to the 1st and the 7th item but if I add another 7 or more it doesn't add it.</p> <p>I need to add the class the every 7th li item.</p>
javascript jquery
[3, 5]
4,985,019
4,985,020
JavaScript: How to select "Cancel" by default in confirm box?
<p>I am displaying a javascript confirm-box message when user clicks on "Delete Data" button. I am displaying it as shown in this image: </p> <p><img src="http://www.exforsys.com/images/js/0800.jpg" alt="alt text"></p> <p>In the image "OK" button is selected by default, I want to select "Cancel" button by default, so that accidently if user presses enter then records will be safe and will not be deleted.</p> <p>Is tehre any way in javascript to sleect "Cancel" button by default??</p>
javascript jquery
[3, 5]
5,403,368
5,403,369
asp.net and jquery ui draggable beginners
<p>Hi im very new to jquery and combining it into my asp.net work stuffs.</p> <p>Ive read the order you reg the jquery files matters, so ive put the core file at the top ? I really dont understand what im getting wrong here :</p> <pre><code> &lt;asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"&gt; &lt;asp:PlaceHolder runat="server" ID="ph"&gt; &lt;script src="development-bundle/ui/jquery.ui.core.js" type="text/javascript"&gt; &lt;/script&gt; &lt;script src="development-bundle/jquery-1.7.2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="development-bundle/ui/jquery.ui.draggable.js" type="text/javascript"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; $(function () { $("#draggable").draggable(); }); &lt;/script&gt; &lt;/asp:PlaceHolder&gt; &lt;asp:Panel ID="pnl_deck_holder" runat="server"&gt; &lt;/asp:Panel&gt; &lt;div id="draggable" class="ui-widget-content"&gt; drag me &lt;/div&gt; &lt;/asp:Content&gt; </code></pre>
jquery asp.net
[5, 9]
2,330,077
2,330,078
Why is this Javascript loop taking one minute for 100 iterations?
<p>I am using the below code in my program but it seems that these few line of code is taking too much time to execute. For 100 iteration it is consuming 1 mins approx. for 200+ iteration my broser is showing a warning message that script is taking too much time. As per the scenario 500+ ids can be pushed into the array.</p> <pre><code>for (var i = 0; i &lt; arrid.length; i++) { $("#" + outerDiv + "&gt; div[id=" + arr[i] + "]").attr("class", "selected"); } </code></pre> <p><code>arrid</code> is an array of div ids. Outerdiv is the the parent div of all these div ids present in <code>arrid</code>. arr ids cannot be accessed directly, it has to be referenced using the parent div i.e. outerDiv.</p>
javascript jquery
[3, 5]
1,428,559
1,428,560
how to jquery event bind to function
<pre><code>&lt;input id='btnExcelRead' name='btnExcelRead' type='submit' runat='server'/&gt; &lt;- actually asp:button &lt;input id='excelUpload' name='excelUpload' type='file' /&gt; &lt;input id='txtStartDate' type='text' /&gt; &lt;input id='txtEndDate' type='text' /&gt; </code></pre> <p>..</p> <pre><code>$(function(){ $("#btnExcelRead").click(CheckValidation); }); var CheckValidation = function() { if ($("#excelUpload").val() === "") { alert("Select file"); return false; } if ($("$txtStartDate").val() === "") { alert("Check the start date!"); return false; } if ($("$txtEndDate").val() === "") { alert("Check the end date!"); return false; } } </code></pre> <p>here i made simple jquery code.</p> <p>I want to bind function when btnExcelRead button click. </p> <p>is this originally wrong way?</p>
javascript jquery
[3, 5]
5,824,077
5,824,078
jQuery .each being applied to broadly
<p>I have a small script which makes an <code>li</code> element click-able and sets the location to that of a link inside of the <code>li</code>. This runs without error and my two <code>console.log()</code> calls are reporting back what I would expect, however, when you click on the <code>li</code> (whichever <code>li</code>) you are taken the <code>href</code> of the link in the last <code>li</code>. This doesn't make much sense to me as I thought I had properly handled the scope. </p> <p>Please correct my understanding and let me know where I went wrong. </p> <p>JavaScript: </p> <pre><code>$(".homeCTA li").each(function(){ $href = $(this).find("a").attr("href"); console.log($(this)); // displays the expected selector console.log($href); // displays the correct href $(this).click(function(){ window.location = $href }); // this is overriding all of the previous passes }); </code></pre> <p>HTML:</p> <pre><code>&lt;ul class="homeCTA"&gt; &lt;li class="left"&gt; &lt;img src="first-source.jpg"&gt; &lt;h2&gt;&lt;a href="SearchResults.asp?Cat=1833"&gt;Yada Yada Yada&lt;/a&gt;&lt;/h2&gt; &lt;/li&gt; &lt;li class="right"&gt; &lt;img src="second-source.jpg"&gt; &lt;h2&gt;&lt;a href="SearchResults.asp?Cat=1832"&gt;Try the bisque&lt;/a&gt;&lt;/h2&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
2,886,688
2,886,689
AutoSuggest in a asp.net
<p>How to auto suggest in a text box in a asp.net page. I want to display names of the users from the user table.</p>
c# asp.net
[0, 9]
5,669,098
5,669,099
API For Voice Chat, support JavaScript as front-end and PHP as the server-side language?
<p>Title says it all.</p> <p>I've searched up <code>audio chat api</code> on Google, and couldn't really find anything, other than TeleSocial, which I can't even figure out how to use. I also searched up <code>voice chat api</code> on Google, and not finding much either.</p> <p>Anybody know of a voice chat api (which, if possible, has a free plan), which I can implement with JavaScript and PHP?</p> <p>Thanks!</p>
php javascript
[2, 3]
5,982,247
5,982,248
state of listbox not saved
<p>I have wizard control and on second page I have ListBox. Since I have disabled viewstate, I am rebinding data source of ListBox on each button click (prev /next).</p> <p>I can not use Request.Form to get selected values since user can come from first page. </p> <p>I am hoping that even if I set viewstate disabled, I will get selected values of ListBox through viewstate.</p> <p>Please let me know how I can retrive selected values for ListBox through viewstate.</p> <p>Thanks,</p>
c# asp.net
[0, 9]
4,020,312
4,020,313
How to catch application error outside global.asax?
<p>How to catch application error outside global.asax ? I want to catch unhandled exception outside global.asax </p>
c# asp.net
[0, 9]
4,868,280
4,868,281
User location not found :- latitude and longitude in android
<p>My code putput always goes in else part. IT means {location} is null.</p> <p>Any suggestions?</p> <pre><code>locManager = (LocationManager)getSystemService(Context.LOCATION_SERVICE); locManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0, locationListener); location = locManager.getLastKnownLocation(LocationManager.GPS_PROVIDER); if(location != null) { double latitude = location.getLatitude(); double longitude = location.getLongitude(); } else { // } ..... ..... .... </code></pre>
java android
[1, 4]
3,358,466
3,358,467
Simple php script to python
<p>How do I convert this simple php script using python? It basically checks whether the variable $<em>POST['page'] is set, and if it is, checks whether the respective page</em>.html file exists, and outputs it back to jQuery.</p> <pre><code>&lt;?php if(!$_POST['page']) die("0"); $page = (int)$_POST['page']; if(file_exists('pages/page_'.$page.'.html')) echo file_get_contents('pages/page_'.$page.'.html'); else echo 'There is no such page!'; ?&gt; </code></pre>
php python
[2, 7]
2,577,633
2,577,634
App_Code and server
<p>I'm having a "tiny" issue with my <code>App_Code</code> folders.</p> <p>I'm learning ASP.NET and, therefore, ordered a webserver with the support of ASP.NET 4.0. I'm using Visual Web Developer to program my webpages. When I upload my website to this webserver everything runs fine.</p> <p>However, if I then add another web project to my server, my <code>App_Code</code> folder gets all messy. The server wants all my class files in the <code>App_Code</code> folder in the root. Is there any way I can create subdirectories in my App_Code folder or something to keep my projects organized or am I missing the point here?</p>
c# asp.net
[0, 9]
40,959
40,960
android event after landscape calculation
<p>I enabled onConfigChanges event and properly handling when device turns from portrait into lanscape. However, after onConfigChanges, when page is calculated again and finishes it, which event is fired? Thank you</p>
java android
[1, 4]
1,527,850
1,527,851
Relative Positioning of DIV
<p>There is div named "dvUsers". there is an anchor tag "lnkUsers".</p> <p>When one clicks on anchortag, the div must open like a popup div just below it.</p> <p>Also the divs relative position should be maintained at window resize and all. How to do that using javascript/jquery?</p>
javascript jquery
[3, 5]
2,709,270
2,709,271
Do I still need $(document).ready(function(){ })?
<p>I've been developing in javascript for a few months and I have been using <code>$(document).ready(function(){</code> at the beginning of all my scripts. I've noticed other folks don't use this in their scripts but I can't seem to get mine working without it. I'd like to keep my code cleaner, but for all my google searches I can't seem to figure out how to get rid of it. </p> <p>I know it tells the browser to execute my script as soon as the page loads but is there something global I can set so that I don't need to explicitly tell the browser to execute each of my scripts when the page loads? Or is it a more global problem with where in my html files the scripts are located?</p>
javascript jquery
[3, 5]
3,784,523
3,784,524
Jquery click event is not working properly
<p>I want a new text input box will be appended when i click onto the latest generated text box. </p> <p>But It generates new text input box only when i click the first text input box. So, any solution?</p> <pre><code>&lt;script type="text/javascript"&gt; $(function(event){ $('.add-new').click(function(){ $('.add-new').removeClass(); $('form').append("&lt;br&gt;&lt;input type='text' name='user[]' class='add-new'/&gt;"); }); }); &lt;/script&gt; &lt;div&gt; &lt;form method='post' name='login'&gt; &lt;input type='text' name='user[]' class='add-new'/&gt; &lt;/form&gt; &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
5,742,444
5,742,445
Inserting values into database from the contact us form of a website
<p>Below is the code of properly designed contact us form:</p> <pre><code> &lt;div class="contact_left_panel"&gt; &lt;p&gt; &lt;label&gt;Name*&lt;/label&gt; &lt;input type="text" value="" name="your-name" class="name"&gt; &lt;/p&gt; &lt;p&gt; &lt;label&gt;E-Mail*&lt;/label&gt; &lt;input type="text" value="" name="your-email" class="msg"&gt; &lt;/p&gt; &lt;p&gt; &lt;label&gt;Phone*&lt;/label&gt; &lt;input type="text" value="" name="your-phone" class="phone"&gt; &lt;/p&gt; &lt;p&gt; &lt;label&gt;Message*&lt;/label&gt; &lt;textarea rows="4" cols="10" name="Description"&gt; &lt;/textarea&gt; &lt;/p&gt; &lt;p&gt; &lt;input type="submit" class="subbtn" value="Send" style=" padding-left:0px;color:#ffff"&gt; &lt;input type="button" class="" style=" padding-left:0px;" value="Clear" &gt; &lt;/p&gt; &lt;/div&gt; </code></pre> <p>The details mentioned in the contact us form must be stored in a table in datbase.Can any one suggest me code regarding how to do this?</p>
c# jquery
[0, 5]
1,487,383
1,487,384
Disable gridview refresh after SQL insert?
<p>I'm using a gridview and SQL data source .</p> <p>After I'm inserting information in data table if I refresh the page the query is executed again and if I refresh it again it will execute again.</p> <p>Is there any way to disable refresh or make the events unique to be executed only once when the event is raised without execution on refresh</p> <p>Thanks</p>
c# asp.net
[0, 9]
3,730,586
3,730,587
applying methods to single elements in an array - jquery/javascript
<p>I've created an array of elements called <code>$images</code> (all the elements in the <code>hidden</code> class.) Then when I try to apply <em>any</em> method to just <em>one</em> element in the array, I get a <code>$images[1].attr is not a function</code> error. However, when I try <code>$images.attr('id')</code> for example without specifying the index of the array, it works but gives me the result for the first element in the array only.</p> <pre><code>$images = $(".hidden"); alert($images[1].attr('id')); </code></pre> <p>What's going here and how can I apply methods to single elements in an array? By the way, I'm certain there are at least two elements in the array as I tested it for this.</p>
javascript jquery
[3, 5]
5,349,838
5,349,839
How Do I Change Div's Content With jQuery To Different PHP Files - Using Hyperlinks - No Refresh Of Page
<p>How Do I Change Div's Content With jQuery To Different PHP Files - Using Hyperlinks - No Refresh Of Page</p> <p>Lets say I have a div with the id of statsdiv</p> <p>Then Lets say I have These Pages:</p> <p>page1.php page2.php page3.php</p> <p>And 3 links.</p> <p>page1 | page2 | page3</p> <p>I need it to preload page1 when the document is first opened, then I need to be able to change to page1, page2, or page3 within 1 div of the page without the page refreshing.</p> <p>I also need that div to refresh every 5 seconds.</p> <p>How can I accomplish this?</p>
php jquery
[2, 5]
3,654,037
3,654,038
Testing URL equivalence in JavaScript/JQuery (obtaining canonical form of URL)
<p>The same URL can be represented in many different representations.<br> e.g. Assuming the browser's currently loaded page is<code>http://www.example.com/about.html</code></p> <p>The following URLs can be considered equivalent from the browser's point of view:</p> <ul> <li><code>http://www.example.com/contact-us.html</code> and <code>http://www.example.com/contact-us.html</code></li> <li><code>http://www.example.com/contact-us.html</code> and <code>contact-us.html</code></li> <li><code>http://www.example.com/contact-us.html</code> and <code>.</code></li> <li><code>http://www.example.com/contact-us.html</code> and <code>/contact-us.html</code></li> </ul> <p>With this in mind, is there an easy way to determine this equivalence using JavaScript?</p> <p>Or, is there a way of obtaining a canonical form of a URL such that the canonical forms can be compared as a way of reaching the answer?</p>
javascript jquery
[3, 5]
1,862,607
1,862,608
How to reduce my repeated jQuery code
<p>first post here at this great website! </p> <p>I would like to reduce the amount of code for the following, espacially as there are more parts I need to add in the future - I'm sure there must be an easy way but I'm just not seeing it. Thanks for your help!</p> <pre><code>$(document).ready(function(){ $(function(){ $('#iqdrive').click( function(){ $('#iqdrive-cont').show(); }); }); $(function(){ $('#optiwave').click( function(){ $('#optiwave-cont').show(); }); }); $(function(){ $('#vario').click( function(){ $('#vario-cont').show(); }); }); $(function(){ $('#autostain').click( function(){ $('#autostain-cont').show(); }); }); $(function(){ $('#autoload').click( function(){ $('#autoload-cont').show(); }); }); </code></pre> <p>});</p>
javascript jquery
[3, 5]
2,565,053
2,565,054
Can I combine two functions into one using Javascript?
<p>I have the following code that I would like to simplify. With javascript and jQuery is there an easy way that I could combine these two functions? Most of the code is the same but I am not sure how I could create a single function that works differently depending on what is clicked. </p> <pre><code>$(document).ready(function () { $('#ListBooks').click(ListBooks); $('#Create').click(Create); }); function Create() { var dataSourceID = $('#DataSourceID').val(); var subjectID = $('#SubjectID').val(); var contentID = $('#ContentID').val(); if (dataSourceID &amp;&amp; dataSourceID != '00' &amp;&amp; subjectID &amp;&amp; subjectID != "00" &amp;&amp; contentID &amp;&amp; contentID != "00") { var e = encodeURIComponent, arr = ["dataSourceID=" + e(dataSourceID), "subjectID=" + e(subjectID), "contentID=" + e(contentID)]; window.location.href = '/Administration/Books/Create?' + arr.join("&amp;"); } else { alert('Datasource, Subject and Content must be selected.'); } return false; } function ListBooks() { var dataSourceID = $('#DataSourceID').val(); var subjectID = $('#SubjectID').val(); var contentID = $('#ContentID').val(); if (dataSourceID &amp;&amp; dataSourceID != '00' &amp;&amp; subjectID &amp;&amp; subjectID != "00" &amp;&amp; contentID &amp;&amp; contentID != "00") { var e = encodeURIComponent, arr = ["dataSourceID=" + e(dataSourceID), "subjectID=" + e(subjectID), "contentID=" + e(contentID)]; window.location.href = '/Administration/Books/ListBooks?' + arr.join("&amp;"); } else { alert('Datasource, Subject and Content must be selected.'); } return false; } </code></pre>
javascript jquery
[3, 5]
3,323,541
3,323,542
How can I detect if element is not display on screen do to scrolling?
<p>When the user scrolls down on my website, I'd like to detect when the very top header is out of view. Is this possible with jquery? </p>
javascript jquery
[3, 5]
3,488
3,489
Clarification/explanation of RegisterClientScriptInclude method
<p>I've been looking on the Internet for a fairly clear explanation of the different methods of registering javascript in an asp.net application. I think I have a basic understating of the difference between registerStartupScript and registerClientScriptBlock (the main difference being where in the form the script is inserted). I'm not sure I understand what the RegisterClientScriptInclude method does or when it is used. From what I can gather, it is used to register an external .js file. Does this then make any and all javascript functions in that file available to the aspx page it was registered on? For example, if it was registered in the onLoad event of a master page, would all pages using that master page be able to use the javascript functions in the .js file? What problems would arise when trying to use document.getElementById in this case, if any? Also, when it is necessary/advantageous to use multiple .js files and register them separately? </p> <p>I appreciate any help you can give. If you know of any really good resources I can use to get a thorough understanding of this concept, I'd appreciate it!</p>
asp.net javascript
[9, 3]
5,344,324
5,344,325
jquery changing innerhtml of a P isn't working
<p>I have what I thought was a simple select with jQuery to change some text on a paragraph. It works perfect the traditional way i.e.</p> <pre><code>document.getElementById('message_text').innerHTML = "hello"; </code></pre> <p>But with jQuery it doesn't. I have checked the values of <code>$('#message_text')</code> and sure enough I see the items.</p> <pre><code>$('#message_text').innerHTML = "hello"; </code></pre> <p>Am I doing something wrong?</p> <p>Anyone have any ideas?</p>
javascript jquery
[3, 5]
2,236,738
2,236,739
Is it possible to run Android apps in JVM?
<p>I am trying to run symbolic testing on Android apps to collect some information, for example, the execution tree. Thus I want to run it in JVM instead of the emulator because there are a lot of existing symbolic testing tools for Java applications. </p> <p>I tried to run HelloAndroid which is a sample app outputting "Hello Android" on TextView by </p> <pre><code>java -cp ./ -cp $ANDROID_LIB/android.jar HelloAndroid.class </code></pre> <p>where HelloAndroid.class is compiled Java class before converting into .dex. But JVM is keeping complaining that </p> <pre><code>Exception in thread "main" java.lang.NoClassDefFoundError: HelloAndroid/class Caused by: java.lang.ClassNotFoundException: HelloAndroid.class </code></pre> <p>I am confused because I've already specify the HelloAndroid class. And there is no complex statements or calls into Android library in the source code:</p> <pre><code>package com.example.helloandroid; import android.app.Activity; import android.os.Bundle; import android.widget.TextView; public class HelloAndroid extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TextView tv = new TextView(this); tv.setText("Hello, Android"); setContentView(tv); } } </code></pre> <p>I am new to Android and am struggling to make this small app to execute in JVM. So would you please give me some suggestion? I am wondering if I am on the right way, I mean try to execute simple apps in JVM? Thanks!</p>
java android
[1, 4]
2,442,006
2,442,007
How to open URI in the native browser (android)
<p>I want to open the page ya.ru in the native browser. That's what I have</p> <pre><code>list.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub String url = "http://ya.ru"; Intent intent1 = new Intent(Intent.ACTION_VIEW); intent1.setData(Uri.parse(url)); startActivity(intent1); } }); </code></pre> <p>Could you tell me what I should write in <code>uses-permissions</code> except</p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt; </code></pre> <p>or is there anything wrong in the code?</p>
java android
[1, 4]
606,029
606,030
~ 'MachineToApplication' beyond application level ~ What does this error means?
<p>What should i do when this error prompt my screen</p> <p>In VS2008 Express Edition</p> <ol> <li>C:\Users\ami\Desktop\MyAddressBookasd\MyAddressBook\UpdateTheRecord.aspx: ASP.NET runtime error: It is an error to use a section registered as allowDefinition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS. </li> </ol> <p><img src="http://i.stack.imgur.com/ozVpu.jpg" alt="enter image description here"></p> <p>In Web Browser</p> <ol> <li>Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately. </li> </ol> <p>Parser Error Message: It is an error to use a section registered as Definition='MachineToApplication' beyond application level. This error can be caused by a virtual directory not being configured as an application in IIS.</p> <p>Source Error: </p> <p>Line 36: ASP.NET to identify an incoming user. Line 37: --> Line 38: Line 39: section enables configuration</p> <p><img src="http://i.stack.imgur.com/uxYtJ.jpg" alt="enter image description here"></p>
c# asp.net
[0, 9]
5,883,823
5,883,824
Display database value based on which radio button is selected
<p>I am suppose to display the database values in a gridview based on which radio button is selected. I'm currently using a RadioButtonList and I'm supposed to display certain transactions based on the transaction date they select in the radio button. For example, if they select View past 1 Month transaction, my gridview is suppose to show only the past one month transaction. I'm currently using C#. </p> <p>The date is retrieved base on system date and are recorded when there are transactions made. May I know how to link the radio transaction with the database using gridview ?</p> <p><img src="http://i.stack.imgur.com/YmHT1.png" alt="enter image description here"> <img src="http://i.stack.imgur.com/hOvTs.png" alt="enter image description here"></p> <p>This is my coding for the gridview.</p> <pre><code> myConnection.ConnectionString = strConnectionString; SqlCommand cmd = new SqlCommand("SELECT thDate, thType, thAmountIn, thAmountOut from [Transaction] ORDER BY thDate, thType, thAmountIn, thAmountOut DESC", myConnection); myConnection.Open(); SqlDataReader reader1 = cmd.ExecuteReader(); GridView1.DataSource = reader1; GridView1.DataBind(); </code></pre>
c# asp.net
[0, 9]
341,769
341,770
Custom ReferenceID property for buttons and menu classes
<p>For ASP controls - let us say we are using button, is it possible to derive from BUTTON, a derived control and create new property called, say , ReferenceID (type say integer) and use that property.</p> <p>I would like to have a unique id for the control other than the ID we are having</p>
c# asp.net
[0, 9]
6,029,469
6,029,470
Jquery Continuously Loop Animation
<p>I'm new to jquery so forgive me if this is a simple question. I need to know how to infinitely loop this animation. It is a text scroll animation and I need it to repeat after it's finished.</p> <p>Here is the jquery:</p> <pre><code>&lt;script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function(){ $(".boxtext").ready(function(){ $(".boxtext").animate({bottom:"600px"},50000); }); }); &lt;/script&gt; </code></pre> <p>Here is the CSS for ".boxtext"</p> <pre><code>.boxtext { position:absolute; bottom:-300px; width:470px; height:310px; font-size:25px; font-family:trajan pro; color:white; } </code></pre>
javascript jquery
[3, 5]
5,554,279
5,554,280
dynamically add remove rows in table using jquery
<p>I have construted my table as follows:</p> <pre><code> &lt;table id="dataTable"&gt; &lt;thead&gt; &lt;tr&gt;&lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Value&lt;/th&gt;&lt;/tr&gt; &lt;/thead&gt; &lt;TR&gt;&lt;TD&gt;Scooby Doo&lt;/TD&gt;&lt;TD&gt;6&lt;/TD&gt;&lt;TD&gt;&lt;INPUT TYPE="Button" onClick="AddRow()" VALUE="Add Row"&gt;&lt;/TD&gt;&lt;/TR&gt; &lt;/table&gt; </code></pre> <p>When the button Add Row is clicked, I need to change the button to a delete button and insert a new row on the first line. The first line must contain the same as in the code. How can I do this?</p> <p>On clicking the delete button, Imust be able to delete the row to which the delete button belong?</p>
javascript jquery
[3, 5]
3,106,085
3,106,086
Summary of form in a <div> with jQuery
<p>I have two input boxes and two select boxes and would like to display a summary of data selected and entered in real time prior to submitting the form. jQuery seems the way to go, but how! </p> <pre><code>&lt;form id="form1" name="form1" method="post" action=""&gt; &lt;select name="Select1" id="Select1"&gt; &lt;option value="Item 1"&gt;Item 1&lt;/option&gt; &lt;option value="Item 2"&gt;Item 2&lt;/option&gt; &lt;option value="Item 3"&gt;Item 3&lt;/option&gt; &lt;/select&gt; &lt;br /&gt; &lt;select name="OtherItem" id="OtherItem"&gt; &lt;option value="OtherItem 1"&gt;OtherItem 1&lt;/option&gt; &lt;option value="OtherItem 2"&gt;OtherItem 2 &lt;/option&gt; &lt;option value="OtherItem 3"&gt;OtherItem 3&lt;/option&gt; &lt;/select&gt; &lt;input type="text" name="textfield1" id="textfield1" /&gt; &lt;input type="text" name="textfield2" id="textfield2" /&gt; &lt;/form&gt;&lt;div id="FormSummary"&gt;&lt;/div&gt; </code></pre> <p>Many thanks</p>
javascript jquery
[3, 5]
1,582,195
1,582,196
get ID of clicked control
<p>Using jQuery I'm trying to get the id of control, which I clicked (radiobutton). I read <a href="http://stackoverflow.com/questions/10578566/jquery-this-id-return-undefined">this question</a> and tried almost everything from there:</p> <pre><code>alert($(this).get(0).id); alert($(this).id); alert($(this).attr('id')); alert(this.id); </code></pre> <p>But I'm always getting: <code>Undefined</code></p> <p>I just don't understand what I'm doing wrong.</p> <p><strong>UPDATED:</strong></p> <p>Radiobuttons is generated dynamically in code behind by C#:</p> <pre><code>controlToReturn = new RadioButton { ID = controlId }; ((RadioButton)controlToReturn).Text = text; ((RadioButton)controlToReturn).Checked = Convert.ToBoolean(Convert.ToInt32(value)); ((RadioButton)controlToReturn).GroupName = groupName; ((RadioButton)controlToReturn).CssClass = cssClass; ((RadioButton)controlToReturn).Attributes.Add("runat", "server"); ((RadioButton)controlToReturn).Attributes.Add("onclick", "Show();"); </code></pre> <p>and function in ASPX:</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; function Show() { if ($(this).cheked = true) { console.log(this); alert($(this).get(0).id); alert($(this).id); alert($(this).attr('id')); alert(this.id); } } &lt;/script&gt; </code></pre> <p>I know radiobutton has id, I checked generated HTML.</p>
c# jquery asp.net
[0, 5, 9]
2,893,452
2,893,453
Split text of textarea on cursor position. (asp.net c#)
<p>what I want to do is to split the text of textarea on cursor position. For example if the text is "hello my world" when the user clicks at the end of hello and press some button then the text should be splitted into two a="hello" and b="my world". Is there anyway I can achieve this ?</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
1,621,080
1,621,081
Bookmark on click using jQuery
<p>Is there a way to save the current page as a bookmark (through jQuery or otherwise) when a specific button is clicked?</p>
javascript jquery
[3, 5]
1,241,000
1,241,001
Ending up with multiple calls (due to cyclical referencing) - JQuery
<p>My objective is fairly simple. In my webapp, I have two pages and I want to call each one from the other page.</p> <p>But the way I have implemented the function calls in Javascript seems to be flawed. I have read up on <code>closure</code>, <code>bubbling</code>, <code>recursion</code> and <code>event.stopPropagation()</code>, but still not sure what the right way to go about implementing this.</p> <p>Here's the smallest code that I could reproduce my problem in.</p> <pre> function init(){ var $div1 = 'Click to Load page 2'; $("#main").append($div1); var $div2 = 'Click to go back to page 1'; $("#main").append($div2); displayFirstPage(); } function displayFirstPage() { var $div1 = $("#div1"); var $div2 = $("#div2"); $div2.hide(); $div1.show(); alert("first called"); $div1.click(function(){ displaySecondPage(); }); } function displaySecondPage() { var $div1 = $("#div1"); var $div2 = $("#div2"); alert("second called"); $div1.hide(); $div2.show(); $div2.click(function(){ displayFirstPage(); }); } </pre> <p>After clicking the divs a few times, I end up with <strong>numerous</strong> alert's popping up. I just want each call to be executed once. Clearly, I am missing the way to terminate the function call.</p> <p>Any help appreciated.</p>
javascript jquery
[3, 5]
5,063,202
5,063,203
Show a javascript loader image while function is executing
<p>I want to click a button, show a loader image, execute a time-consuming function, hide the loader image. When I attempt this, the page freezes until the entire event runs, so the loader image is never seen.</p> <p>Here is a sample:</p> <pre><code>$('#btn').click(function() { $('#LoadingImage').show(); &lt;time consuming function&gt; $('#LoadingImage').hide(); }); </code></pre> <p>How can I distinctly show the loader image, update the screen, run the function, hide the loader image?</p>
javascript jquery
[3, 5]
431,905
431,906
Posting data via js/jQuery
<p>I am really new to Javascript and its many brilliant libraries, I find even the most simple scripts hard to perform. </p> <p>I do want to learn this language, because it would be powerful for creating client websites, however at the moment I am trying to do something relatively simple, this is to flag a personal message on my site. There are many messages in a big list, and what I am looking at doing is when the user clicks the "Flag PM" image, it will run flag.php in the background which will change the flag field in MySQL from 0 to 1.</p> <p>This script is all dependant on one field, that is id so I can run this through the database. Anyway, here is my code;</p> <p><strong>flag.php</strong></p> <pre><code> require('_inc/_core/core.php'); // inc core_funcs for sql &amp; clean $pm_id = clean($_POST['p_id']); // create new variable, clean the post echo "The ID for the PM is " . $pm_id; mysql_query("UPDATE `messages` SET `flag_status` = 1 WHERE `id` = {$pm_id}"); // update the db </code></pre> <p><strong>JS/jQuery</strong></p> <pre><code> // Flag a Personal Message $("#flagPM").submit(function(event) { event.preventDefault(); $.post("flag.php", { p_id: pm_id } ); alert(event); }); </code></pre> <p><strong>HTML handling the form</strong></p> <pre><code>&lt;form action="#" id="flagPM"&gt;&lt;input type="hidden" id="pm_id" value="$id" /&gt; &lt;input type="submit" class="submit" value="FLAG" /&gt;&lt;/form&gt; </code></pre> <p>So there is a hidden input field named <strong>pm_id</strong> that contains what I want posted. </p> <p>Would really appreciate some help, the Javascript is being run from an independent file that is two directory's up from flag.php</p> <p>Thank you</p>
javascript jquery
[3, 5]
3,179,681
3,179,682
Comma separated values: from strings to objects to list
<p>I'm measuring myself with a small javascript headache, maybe I'm just too tired.</p> <p>I have 3 variables with strings containing comma separated values (I don't know how many) which I want to combine into jQuery objects.</p> <pre><code>"name1,name2,name3,nameN" "value1,value2,value3,valueN" "id1,id2,id3,idN" </code></pre> <p>to:</p> <pre><code>var item1 = { name: name1, value: value1, id: id1 }; var item2 = { name: name2, value: value2, id: id2 }; var item3 = { name: name3, value: value3, id: id3 }; var itemN = { name: nameN, value: valueN, id: idN }; </code></pre> <p>To then iterate an operation over each item, for example to append a list:</p> <pre><code>&lt;h3&gt;items&lt;/h3&gt; &lt;ul&gt; &lt;li&gt;item1&lt;/li&gt; &lt;ul&gt; &lt;li&gt;value: &lt;b&gt;value1&lt;/b&gt;&lt;/li&gt; &lt;li&gt;id: &lt;b&gt;id1&lt;/b&gt;&lt;/li&gt; &lt;/ul&gt; [...] &lt;li&gt;itemN&lt;/li&gt; &lt;ul&gt; &lt;li&gt;value: &lt;b&gt;valueN&lt;/b&gt;&lt;/li&gt; &lt;li&gt;id: &lt;b&gt;idN&lt;/b&gt;&lt;/li&gt; &lt;/ul&gt; &lt;ul&gt; </code></pre> <p>But I'm horribly stuck :).</p>
javascript jquery
[3, 5]
1,583,105
1,583,106
'jquery' is not a valid script name. The name must end in '.js'
<p>My APS.Net project is working well, when suddenly we had a power failure. When I ran my web app, it is now showing a lot of <em>"Could not load assembly Sanitizer..." then "Could not load "HtmlAgility..."</em> errors. I was able to resolve these previous errors by uninstalling/reinstalling them using <em>Manage Nuget Package Solutions</em> inside Visual Studio 2012. </p> <p>But now I encountered <strong>"'jquery' is not a valid script name. The name must end in '.js'."</strong>. I tried to do same thing by re-installing the package but it does not work. What should I do to resolve this? I already have a jquery.js file located on my root\Scripts folder. I also added reference to this file inside my section:</p> <pre><code>&lt;script src="Scripts/jquery.js"&gt;&lt;/script&gt; </code></pre> <p>But still it won't work. Please help.</p>
jquery asp.net
[5, 9]
5,458,864
5,458,865
Get all the events bound by .on() in jQuery
<p>I've a page load some contents by Ajax, and also bind events via <code>.on()</code> method to the new comming elements.</p> <p>Is there anyway to get all the binding events on <code>&lt;div class="inner"&gt;</code>? I've try <code>$("div.inner").data('events')</code> in the console <strong>after all contents loaded</strong>, but there is nothing but <code>undefined</code>. </p> <p>Html:</p> <pre><code>&lt;div id="out"&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;​ </code></pre> <p>JavaScript: (not really ajax, just a simulation)</p> <pre><code>var innDiv = '&lt;div class="inner"&gt;inner&lt;/div&gt;' + '&lt;div class="inner"&gt;inner&lt;/div&gt;' + '&lt;div class="inner"&gt;inner&lt;/div&gt;'; $(document).on('click','.inner', function(){$(this).toggleClass("green")}); setTimeout('$("#out").append(innDiv)',2000);​ </code></pre> <p>Here is the <a href="http://jsfiddle.net/vcX7k/" rel="nofollow">jsfiddle Code</a> demo.</p>
javascript jquery
[3, 5]
5,283,698
5,283,699
How to define a property instead of public variable in C#
<pre><code>public static string SEARCH_STRING = "searchkey"; string key=Request.QueryString.Get(SEARCH_STRING); </code></pre> <p>How to change the above code to make SEARCH_STRING be accessed using a Property(get; set;) instead of a public variable</p>
c# asp.net
[0, 9]
760,746
760,747
C# Image and label issue
<p>I have an issue when I'm trying to make my image or label visible in my web app. </p> <pre><code>using System; using System.Linq; using System.Web.Security; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Web.Services; using System.IO; using System.Web.UI.Adapters; public partial class Admin : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Timer1_Tick(object sender, EventArgs e) { if (File.Exists("c:/test.pdf")) //inform user Console.WriteLine("File uploaded."); Image1.visible = true; </code></pre> <p>I'm getting an error as follows: </p> <pre><code>The name 'Image1' does not exist in the current context </code></pre> <p>Any ideas here? Ive done this before without issue, but for some reason it doesn't like the <code>image1</code> (which i put on my webpage and made <code>visible = false</code>) nor the label which is also <code>visible = false</code>. </p>
c# asp.net
[0, 9]
233,226
233,227
Merge two paragraphs together and deleting an element in middle
<p>I have a div contentEditable with paragraphs and appended after each p is a span telling me the length of the paragraph the user can edit the line &amp; thus update the number shown in the span, (done with something on these lines .each(fu..(){ p append '&lt;span>'+ this.length ..)</p> <p>Let's say something like this:</p> <pre><code>&lt;div contenteditable="true"&gt; &lt;p&gt;abc&lt;span contenteditable="false" style="position:absolute;right:-2em;backg..."&gt;3&lt;/span&gt;&lt;/p&gt; &lt;p&gt;abce&lt;span ...&gt;4&lt;/span&gt;&lt;/p&gt; &lt;p&gt;abcfoo&lt;span ...&gt;6&lt;/span&gt;&lt;/p&gt; &lt;p&gt;abcbar&lt;span ...&gt;6&lt;/span&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p>Have made all the spans uneditable in order to protect the spans and the text, on hitting return a new &lt;p> is created on the next line - all sparky! However I have no way of deleting a new paragraph as the back button on the first letter of a p acts as the browser back button! because its hitting the non editable span.</p> <p>So I would like to add a button (perhaps on the span) which when clicked will 1. remove the span (not too difficult), 2. merge the 2 paragraphs together.</p>
javascript jquery
[3, 5]
637,186
637,187
How to remove only position(top and left) of Style attr using JQuery?
<p>I am dynamically setting the position attr of the element only when the view is out of viewport of the window, in other case default value is set from the css file , </p> <pre><code>.css( { "left": (left + 20) + "px", "top": (top+10) + "px" } ); </code></pre> <p>Once the dynamic position is set, I want to remove the position attr alone.</p> <p>I can remove style attribute it will also my display property of style which is required.</p> <p>Is there a way to to remove the position attr alone?</p>
javascript jquery
[3, 5]
2,417,456
2,417,457
Change text based on select box value
<p>Full Disclosure: I am bad at javascript.</p> <p>I'm trying to write something that takes the value of a select box (in this case, it contains a list of themes the user can choose from), compares it against an array containing all the themes allowed, and display a preview link to the user.</p> <p>Below is some select code.</p> <p>My Array containing the preview links:</p> <pre><code>var themePreview = []; themePreview[0] = '&amp;nbsp;&amp;nbsp;&lt;a href="http://www.trafficgettingblogs.com/?preview=1&amp;template=arclite&amp;stylesheet=arclite&amp;TB_iframe=true&amp;width=1000&amp;height=700" class="thickbox thickbox-preview"&gt;Preview Arclite&lt;/a&gt;'; themePreview[1] = '&amp;nbsp;&amp;nbsp;&lt;a href="http://www.trafficgettingblogs.com/?preview=1&amp;template=arras&amp;stylesheet=arras&amp;TB_iframe=true&amp;width=1000&amp;height=700" class="thickbox thickbox-preview"&gt;Preview Arras&lt;/a&gt;'; themePreview[2] = '&amp;nbsp;&amp;nbsp;&lt;a href="http://www.trafficgettingblogs.com/?preview=1&amp;template=carrington-blog&amp;stylesheet=carrington-blog&amp;TB_iframe=true&amp;width=1000&amp;height=700" class="thickbox thickbox-preview"&gt;Preview Carrington Blog&lt;/a&gt;'; </code></pre> <p>My jQuery attempting to get the select box value and display a preview link:</p> <pre><code>$('select #selectedTheme').change(function() { //document.write('test'); // Try to see if I'm selecting what I need. $('#previewTheme').value() = themePreview[$('#selectedTheme option:selected').value()]; }); </code></pre> <p>The select box has an ID of <code>selectedTheme</code>.</p> <p>I'm not getting any errors, but I don't seem to be selecting the select box.</p> <p>I am sure this is a very simple problem. I'm trying to improve my javascript skills. Rather unsuccessfully, it seems.</p>
javascript jquery
[3, 5]