Unnamed: 0
int64
302
6.03M
Id
int64
303
6.03M
Title
stringlengths
12
149
input
stringlengths
25
3.08k
output
stringclasses
181 values
Tag_Number
stringclasses
181 values
3,170,615
3,170,616
Using Javascript to detect the bottom of the window and ignoring all events when a request is loading
<p>I have an anonymous function to detect the user has scrolled to the bottom of the window. Inside of the anonymous function, I have a call to a database that takes a while to complete.</p> <pre><code>var allowing_more = 1; $(window).scroll(function() { if (allowing_more == 1){ if ($(window).scrollTop() + $(window).height() == $(document).height()) { allowing_more = 0; //query allowing_more = 1; } } }); </code></pre> <p>In this time, if the user scrolls to the bottom of the window again, it seems a queue is made holding the occurences the user scrolled to the bottom of the window while the query was loading. Upon completing of the query, these occurences are then executed.</p> <p>I have a boolean statement to detect if the anonymous function is accepting more query requests but this seems to be ignored.</p> <p>Is there some sort of way to ignore an anonymous function temporarily and re-enable it?</p>
javascript jquery
[3, 5]
5,134,885
5,134,886
how to close client pop up windows
<p>How do I close all child popup windows which are already opened using jquery, after the user logs out?</p>
javascript jquery
[3, 5]
1,492,694
1,492,695
get id of a hyperlink inside datalist using javascript
<p>i have a datalist and inside it there is a dropdown list and hyperlink which is loaded dynamically,means if there is one user then there will be one dropdown and one hyperlink and there are two users then there will be two dropdown and two hyperlink.My requirement is when an onchange event occurs in a dropdown i want the id of the hyperlink assosiated with that dropdown in javascript.Can any one help me please.</p> <p>thanks </p>
javascript jquery asp.net
[3, 5, 9]
4,423,847
4,423,848
jquery next button focus
<p>To improve navigation on one of the pages I am tyring to set a focus on a next available(enabled) button when leaving last data entry field. </p> <pre><code>$('input[type=text], select, textarea').filter(':last').blur(function() { $('input[type=submit][type=button]:enabled:first').focus(); }); </code></pre> <p>For some reason it only works when last data entry field is textbox. Something is wrong in the handler.</p>
asp.net jquery
[9, 5]
4,078,410
4,078,411
Run JavaScript After DataBind
<p>I have a ASP.Net Repeater control with a Table inside it. Is it possible to run a JavaScript function directly AFTER I call <code>MyRepeater.DataBind()</code>? I've been trying different things, but nothing is triggering the JavaScript function.</p> <p>Thanks</p>
javascript asp.net
[3, 9]
2,694,725
2,694,726
Why do jQuery show() parameters not delay before calling the `complete` function?
<p>The <a href="http://api.jquery.com/show/" rel="nofollow">jQuery API documentation for <code>show()</code></a> states that as of jQuery 1.4.3, one can call <code>.show()</code> like so:</p> <pre><code>.show( [duration ] [, easing ] [, complete ] ) </code></pre> <p>With the arguments being:</p> <blockquote> <ul> <li><code>duration</code> (default: 400): A string or number determining how long the animation will run.</li> <li><code>easing</code> (default: swing): A string indicating which easing function to use for the transition.</li> <li><code>complete</code>: A function to call once the animation is complete.</li> </ul> </blockquote> <p>I don't need easing, so I just call this version:</p> <pre><code>.show( [duration ] [, complete ] ) </code></pre> <p>I have one function which is supposed to show a div, wait 5 seconds, then fade out over 500ms.</p> <p>I have tried this:</p> <pre><code> $('#some_div').show( { duration: 5000, complete: function() { fadeOutHelper(500); } } ); </code></pre> <p>And this:</p> <pre><code>$('#some_div').show(5000, function() { fadeOutHelper(500); } ); </code></pre> <p>And in neither case will <code>show()</code> actually wait 5000ms before calling the helper function.</p> <p>I found a work-around on StackOverflow using <code>setTimeout()</code>: <a href="http://stackoverflow.com/questions/3428766/jquery-show-for-5-seconds-the-hide">jQuery show for 5 seconds the hide</a></p> <pre><code>$('#some_div').show(); setTimeout(function() { fadeOutHelper(500); }, 5000); </code></pre> <p>Although I have a work-around, I would like to understand how I am misunderstanding some very simple function arguments in the jQuery <code>show()</code> docs.</p>
javascript jquery
[3, 5]
507,316
507,317
Need help regarding building logic, adding properties to object
<p>I have an images array in which there are number of images. Not fixed, may be one or two or 8. When i have fixed number of images then i was using the code something like this</p> <pre><code>var details = { image1: { position: 0, title: $slideDiv.children().eq(0).attr("alt") }, image2: { position: -400, title: $slideDiv.children().eq(1).attr("alt") }, image3: { position: -800, title: $slideDiv.children().eq(2).attr("alt") }, image4: { position: -1200, title: $slideDiv.children().eq(3).attr("alt") }, image5: { position: -1600, title: $slideDiv.children().eq(4).attr("alt") } }; //end of var details </code></pre> <p>But now i have images in array. I want that details object has added images in it equal to number of images in the array. I tried something like this</p> <pre><code>var details = {}; var position = 0; images.each(function(index){ details.("image" + index) : { position: position, title: $slideDiv.children().eq(index).attr("alt") } position += -400; }) ; //end of .each() </code></pre> <p>The logic that i am trying to make is if i have two images in the images array the it should become something like this</p> <pre><code>var details = { image1: { position: 0, title: $slideDiv.children().eq(1).attr("alt") }, image2: { position: -400, title: $slideDiv.children().eq(2).attr("alt") } } </code></pre> <p>but this is not working. Of course my syntax is wrong</p> <pre><code>details.("image" + index) : {..} </code></pre> <p>How can i do this?</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,200,405
3,200,406
How can I trigger on URL change in jQuery?
<p>How can I trigger a function when the URL changes? I try something like:</p> <pre><code>$(windows.location).change(function(){ //execute code }); </code></pre> <p>So my URL is something like <code>http://www.mysite.com/index.html#/page/1</code>. How can I execute jQuery or JavaScript code when the URL becomes something like <code>http://www.mysite.com/index.html#/page/2</code>?</p>
javascript jquery
[3, 5]
1,158,480
1,158,481
How can I only focus in on an "input:text" without triggering its bound focus event handler
<p>I get a input:text, I want to focus in on it, but I do not want to trigger it's binded event handler. What can I do?</p> <p>I guess:</p> <ol> <li>get the handler</li> <li>unbind it</li> <li>focus</li> <li>bind it</li> </ol>
javascript jquery
[3, 5]
5,597,502
5,597,503
Counting no. of dropdownlists inside a div
<pre><code>&lt;div id="myDiv"&gt; &lt;select id="ddl1" name="31"&gt; &lt;option value="1"&gt;One&lt;/option&gt; &lt;option value="2"&gt;Two&lt;/option&gt; &lt;option value="3" selected="selected"&gt;Three&lt;/option&gt; &lt;/select&gt; &lt;select id="ddl2" name=32&gt; &lt;option value="1"&gt;A&lt;/option&gt; &lt;option value="2" selected="selected"&gt;B&lt;/option&gt; &lt;option value="3"&gt;C&lt;/option&gt; &lt;/select&gt; &lt;/div&gt; </code></pre> <p>Thats my div. The number of dropdowns inside this div vary. What I want is this in a string:-</p> <pre><code>31,3||32,2 </code></pre> <p>The above is name attribute value of dropdowns, 2nd number after comma is the "value" of the selected option and values of both dropdownlists are separated by pipe symbol. The dropdowns can be 3 and 4 in number too. How can I acheive this in jquery?</p>
javascript jquery
[3, 5]
4,914,435
4,914,436
Why is this activity not starting?
<p>I am new to android development. I have an activity which is not even getting to its <code>onCreate()</code> function. I am using some 'Log.d's to check flow of control, and no Log.d inside the <code>onCreate</code> is getting executed at runtime. What am I doing wrong? The starting part of the class is below:</p> <pre><code> public class MainActivityap extends Activity implements IMediaPlayerServiceClient { private StatefulMediaPlayer mMediaPlayer; private StreamStation mSelectedStream = new StreamStation("","http://nbc.com/154.mp3"); private MediaPlayerService mService; private boolean mBound; private ProgressDialog mProgressDialog; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { Log.d("msg", "msg0"); super.onCreate(savedInstanceState); Log.d("msg", "msg1"); setContentView(R.layout.main); Log.d("msg", "msg2"); bindToService(); Log.d("msg", "msg3"); mProgressDialog = new ProgressDialog(this); Log.d("msg", "msg4"); initializeButtons(); setupStationPicker(); }..... </code></pre>
java android
[1, 4]
2,675,055
2,675,056
How to access an element that is placed next to it?
<p>I have following html structure:</p> <pre><code>&lt;span class="thump"&gt;1&lt;/span&gt; &lt;a class="tp" href="#" programm="5"&gt;Post&lt;/a&gt; </code></pre> <p>Now I want to write thump according to programm attribute. This is how I get the the a element according to the programm number:</p> <pre><code>$("a.tp[programm='" + programm + "']"); </code></pre> <p>How do I refer to the thump element that is next to this a element?</p>
javascript jquery
[3, 5]
2,533,900
2,533,901
Javascript: Validation for special charaters
<p>Im working on some validations and can't seem to wrap my head around checking for special chars, none should be used. Currently I grab the value, make an array and check for uppercase and numbers. I need a way to check for special chars as well. Another small issue I found is that it passes an uppercase when a number is entered. Just looking for some direction on how to tackle this.</p> <pre><code>$('.tooltip').on({ focusin: function(){ //make var top = $(this).offset().top var left = $(this).offset().left + $(this).outerWidth() $('.tip').remove() $('body').append("&lt;div class='tip' style='top:"+ top +"px;left:"+left+"px;'&gt;&lt;div class='arrow'&gt;&lt;/div&gt;&lt;/div&gt;") $('.tip').animate({width: 'show', opacity: 'show'}) $(tipContent).appendTo('.tip') }, focusout: function(){ //remove $('.tip').fadeOut(function(){$(this).remove()}) }, keyup: function(){ if (event.keyCode == 16) return //validate var val = $(this).val() validate(val.split(""), val); }, }) function validate(letters, val){ for (var i = 0; i &lt; letters.length; i++){ if( letters[i] === letters[i].toUpperCase() ) { //uppercase check console.log(letters[i] + ": " + 'Uppercase Passed'); }else{console.log('Uppercase Failed'); } if( letters.length &gt;= 9 ) { //min limit console.log(letters[i] + ": " + 'Minimum Limit Passed'); }else{console.log('Minimum Limit Failed'); } if( parseInt(letters[i]) &gt; 0 ) { //number check console.log(parseInt(letters[i]) + ' passed'); }else{console.log('at least 1 char failed'); } } } </code></pre>
javascript jquery
[3, 5]
3,297,938
3,297,939
Testing backwards compatibility?
<p>how can I test backwards compatibility in android emulator? I have a testapp with SDK 15. Now if I switch the compiler version to SDK 7 (for running it on Android2.1 emulation), Eclipse complains about all used imports contained only >SDK7. Of course.</p> <p>But in my code I care about the critical code by <code>if(Build.VERSION.SDK_INT &gt; 11)</code>..., so this should not be a problem when running on older devices. Anyhow, of course eclipse still keeps complaining.</p> <p>So, how can I make these backwards testing?</p>
java android
[1, 4]
3,197,009
3,197,010
Listbox always returns 0
<p>I am loading a ListBox OnSelectedChange of DropDownlist. If I select a 3rd value from the ListBox, it always returns 0. What could be wrong? I appreciate any help. Thank you. Here is my code.</p> <pre><code> &lt;asp:DropDownList ID="dropdown1" runat="server" Width="300" OnSelectedIndexChanged="onChange" AutoPostBack="true"&gt; &lt;asp:ListBox ID="list1" runat="server" Width="300" Rows="12" CausesValidation="true"/&gt; protected void OnChange(object sender, EventArgs e) { LoadListBox(); } void LoadListBox() { list1.Items.Clear(); System.Data.DataTable rows = new System.Data.DataTable(); rows = DAL.GetValues(); foreach (System.Data.DataRow row1 in rows.Rows) { list1.Items.Add(new ListItem(row1["measurement"].ToString().Trim(), row1["measurement"].ToString())); } } </code></pre>
c# asp.net
[0, 9]
2,688,216
2,688,217
Page jumps to top when using Javascript rotating background
<p>I am using javascript for a rotating background image. The problem is, every time the image changes, the page jumps to the top. Hopefully this is an easy fix!</p> <p>Here is my code:</p> <pre><code>&lt;script type='text/javascript'&gt; $(window).load(function(){ var initialBg = $('#slider').css("background-image"); // added var firstTime = true; var arr = [initialBg, "url(/wp-content/uploads/2013/03/slider2-explore.png)", "url(/wp- content/uploads/2013/03/slider3-experience.png)"]; (function recurse(counter) { var bgImage = arr[counter]; if (firstTime == false) { $("#slider").fadeOut("slow", function(){ $('#slider').css('background-image', bgImage); }); $("#slider").fadeIn("slow"); } else { firstTime = false; } delete arr[counter]; arr.push(bgImage); setTimeout(function() { recurse(counter + 1); }, 4500); })(0); }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
1,250,491
1,250,492
Android dev - TextView won't show up
<p>I just started experimenting with Android app development and so I decided to give Android's own tutorials a go (this one: <a href="http://developer.android.com/training/basics/firstapp/starting-activity.html" rel="nofollow">http://developer.android.com/training/basics/firstapp/starting-activity.html</a> ) </p> <p>The textview in my new activity just won't show. Here's my code:</p> <pre><code>public class DisplayMessageActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /* Get the intent and the message sent with it */ Intent intent = getIntent(); String message = intent.getStringExtra(GoogleTutActivity.EXTRA_MESSAGE); /* Create a new textview where we can show the message the user sent */ TextView textView = new TextView(this); textView.setTextSize(40); textView.setText(message); setContentView(R.layout.activity_display_message); } } </code></pre>
java android
[1, 4]
4,092,911
4,092,912
Can I say that ASP.NET is compiled?
<p>You know that C# is a compiled language. But when we develop web applications we use ASP.NET + C#, in this case can we say that ASP.NET is compiled? </p> <p>If ASP.NET is not compiled does it affect the performance of C# when ASP.NET and C# works beside each other to develop web applications? </p>
c# asp.net
[0, 9]
4,645,092
4,645,093
The change event is not triggered before the beforeunloadhow
<p>I know there are lots of questions about the "beforeunload" event and I think I read most of them. So I wrote the following code to warn a user about leaving a page before saving data, and it works most of the time.</p> <p>It does not work when the user enters a value in input "f1" and leaves the page before tabbing out of the "f1". In that case the beforeunload event triggers before the change event and no warning is issued.</p> <p>How should I modify the code?</p> <p>thanks</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var g_page_changed = false; $(document).ready(function(){ $(window).bind('beforeunload', function() { if (g_page_changed) { return 'Do you really want to leave without saving?' ; } }); $('input').change(function() { g_page_changed = true; }); }); &lt;/script&gt; &lt;form id="frm"&gt; &lt;input id="f1" name="f1" type="text"/&gt; &lt;/form&gt; </code></pre>
javascript jquery
[3, 5]
3,715,883
3,715,884
jquery form submitting
<p>index.php</p> <pre><code>&lt;form method="post" action="read.php"&gt; &lt;p&gt;Name: &lt;input type="text" name="name" value="" /&gt;&lt;/p&gt; &lt;p&gt;&lt;button type="submit"&gt;Okay&lt;/button&gt;&lt;/p&gt; &lt;/form&gt; </code></pre> <p>i'd like to send name value to read.php without refreshing the page. i wanna use jquery. but how?</p> <p>Edit: i want to make this job without refreshing the page. well, i tried every examples, and they sent me to read.php after pressing the okay button. i dont wanna go to read.php.</p> <p>edit2: lol, we can't send a value to another page without refreshing the page :) such a shame for us. lol</p>
php jquery
[2, 5]
1,186,948
1,186,949
Using a development language (Python) before putting it into C++
<p>I'm kinda having a debate here with my friend, whether it's OK to have a development language before putting the idea into C++.</p> <p>When I say development language I mean a language to try ideas out before putting them into the compiled language, in this case C++.</p> <p>My friend thinks it's unnecessary (and maybe a waste of time) to do this because we basically have to re-write code, or in other words, port the code from the dev language to C++ code.</p> <p>I think otherwise though, it saves a lot more time to be porting the code than to wait for the C++ code to be compiled over and over while we test little things out.</p> <p>FYI, we're talking about code for a small application, the idea is for the entire application (actually a game), once done weighs less than 100MB, however I'm aware the size already compiled is much MUCH smaller than in code.</p> <p>Of course, this can also go the other way around, should we only use the compiled language (C++) or should we only use the scripting language (Python).</p> <p>Thanks for your help!</p>
c++ python
[6, 7]
4,284,488
4,284,489
Can't call page method from JQuery?
<p>I have a page called AddNews.aspx and in codebehind a web method called AddNews(Parameters)..</p> <p>AddNews.aspx page is inherited from a master page.. So i used contentplaceholder.</p> <p>I have a button..It's id is btnSave.</p> <p>Here is jquery code:</p> <pre><code>$(function() { $("[id$='_btnSave']").click(function() { $.ajax({ type: "POST", contentType: "application/json; charset=utf-8", data: $.toJSON(veriler), url: "AddNews.aspx/AddNews", dataType: "json", success: function(result) { $("#result").html('News added'); }, error: function() { alert('Problem'); } }); }); }); &lt;/script&gt; </code></pre> <p>Button click trigger now.. But it doesnt call Web Page Method.. What's the problem?</p>
asp.net jquery
[9, 5]
2,920,001
2,920,002
Which is faster when reading large amounts of data: XML or SQLite
<p>I will be developing a dictionary app for both Android and iPhone. The data will be embedded within the app, and it consists out of approximately 100000 words, with genus and plural form. Is it better to use a SQLite database or can I just stick to XML? Somehow SQLite sounds more efficient, but I thought let's just ask.</p> <p>Thanks!</p>
iphone android
[8, 4]
2,966,420
2,966,421
Writing a quiz application
<p>im making a quiz application in asp.net using c#. The following code is my start page where on clicking on start i'm redirected to my questions page. The only reason I've added a start.aspx page ... so I could initialize the values in the Session. Here in the page_load event the- request.QueryString["testid"] always resulting to null? i.e my if condition is never true and everytime i'm redirected to my "default.aspx" page. what is the reason?</p> <pre><code>using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Collections; namespace TESTPROJ2 { public partial class START : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ArrayList a1 = new ArrayList(); Session.Add("answerlist", a1); Session.Add("quizid", 1); if (Request.QueryString["testid"] != null) { int testID = int.Parse(Request.QueryString["testid"]); Session.Add("quizid", testID); } else { Response.Redirect("DEFAULT.aspx"); } } protected void startB_Click(object sender, EventArgs e) { Response.Redirect("QUEST.aspx"); } } } </code></pre>
c# asp.net
[0, 9]
4,571,142
4,571,143
How can convert YYYY-MM-DD hh mm ss into MonthName, date, year | Hour:Minuts (am/pm) in JavaScript or jQuery
<p>I have date string <code>(2013-03-10 19:43:55)</code> and want to convert it in this format <code>(Mar 10, 2013 | 7:43 pm)</code> using JavaScript or jQuery. How can I do this ??</p>
javascript jquery
[3, 5]
561,825
561,826
jQuery-not in pure JavaScript
<p>How can I write the following jQuery-not…</p> <pre><code>$(".hover").not(".selected"); </code></pre> <p>… in pure JavaScript?</p>
javascript jquery
[3, 5]
4,338,653
4,338,654
jQuery "load()" Can't Load PHP "curl_exec()" Result
<p>I want an HTML file to load the result of "curl_exec()" method of a PHP file.</p> <p>The PHP file is located in localhost, and the HTML file can be anywhere.</p> <p>Eg the PHP file name is "curl.php".</p> <p>I used jQuery "load()" to load the result, but it doesn't work, even after I upload the files to a web server.</p> <p>The HTML file code:</p> <p><a href="http://jsfiddle.net/aTkEZ/" rel="nofollow">http://jsfiddle.net/aTkEZ/</a></p> <p>The "curl.php" code:</p> <p><a href="http://jsfiddle.net/Quk8N/" rel="nofollow">http://jsfiddle.net/Quk8N/</a></p> <p>What is wrong with my code?</p>
php javascript jquery
[2, 3, 5]
883,509
883,510
Select portion of input/string instead of all of it
<p>I have an input that holds a date value like so</p> <pre><code>03/15/2012 </code></pre> <p>I am trying to select only portions of the the value instead of the whole thing. For instance if I click the spot before 2 in 2012 the year 2012 will be selected not the whole date (same for is true for months and day).</p> <p>This is the code I am working with now</p> <p>html:</p> <pre><code>&lt;input class = "date-container" /&gt; </code></pre> <p>javascript/jquery:</p> <pre><code>$('.date-container').on('select', function (e) e.preventDefault() this.onselectstart = function () { return false; }; }) $('.date-container').on('focus', function () { if (document.selection) { this.focus(); var Sel = document.selection.createRange(); Sel.moveStart('character', -this.value.length); CaretPos = Sel.text.length; } // Firefox support else if (this.selectionStart || this.selectionStart == '0') switch (this.selectionStart) { case 0: case 1: this.selectionStart = 0; this.selectionEnd = 1; break; } } </code></pre> <p>I have tried a couple things so far. The code above is attempting to prevent the normal select action then based on where the focus is, select a portion of the string(I only have the switch statement options for the month portion, but if it worked I would do the same for day and year). This may be the wrong way to go about it. </p> <p>Things to note:</p> <p>By select I mean highlight.</p> <p>I do not want to use plugins. </p>
javascript jquery
[3, 5]
5,216,814
5,216,815
Time Counter using php and jquery
<pre><code>function next_second(){ var target = '1350840000'; var now = &lt;?php echo time();?&gt;; alert(now); } $(function() { setInterval(next_second, 1000); }); </code></pre> <p>the above alert function always returns same value. Am i doing something wrong?</p>
php jquery
[2, 5]
2,712,337
2,712,338
Function without final argument, which includes Runnable()
<p>How to create function without final argument, which includes Runnable()?</p> <pre><code> public void scroll(int scroll_to) { final HorizontalScrollView scrl = (HorizontalScrollView)findViewById(R.id.horizontalScrollView1); scrl.post(new Runnable() { public void run() { scrl.scrollTo(0, scroll_to); } }); } </code></pre> <p>But this cannot refer to non-final <code>scroll_to</code> variable. How to do universal function to scroll? Without <code>Runnable</code> it does not always work.</p>
java android
[1, 4]
1,787,871
1,787,872
adding a class to some images based on the alt text using jquery?
<p>how can i add a class to some images based on the alt text using jquery?</p> <p>here is an example of the image:</p> <pre><code>&lt;img border="0" src="images/Product/icon/26086_1_.jpg" alt="Show Picture 1" onclick="setcolorpicidx_26086(1);" style="cursor:hand;cursor:pointer;"&gt; </code></pre> <p>so if the alt text contains "Show Picture" then add a class of <code>image-nav</code></p>
javascript jquery
[3, 5]
3,424,781
3,424,782
jQuery selectors after dynamic reload, and $(this)
<p>I need some help. I load a list of entries in a div every 5 seconds. Each entry is a div and has a unique ID. Like this:</p> <pre><code>&lt;div class="entry"&gt; &lt;div class="textbox"&gt; &lt;p class="entry-text"&gt; &lt;?php echo $text;?&gt; &lt;/p&gt; &lt;/div&gt; &lt;div class="infobox"&gt; &lt;p class="date"&gt;&lt;a #&lt;?php echo $id;?&gt; id="&lt;?php echo $id;?&gt;" href="gen_details.php?id=&lt;?php echo $id;?&gt;"&gt;&lt;?php echo $t;?&gt;&lt;/a&gt; &lt;/p&gt; &lt;p class="ip"&gt;&lt;?php echo $ip;?&gt;&lt;/p&gt; &lt;/div&gt; </code></pre> <p></p> <p>These, as I said are loaded each 5 seconds. I'm adding a details page for every entry, with this:</p> <pre><code> $('.date a').click(function () { var dataString = 'id=' + $(this).attr("id"); //alert(dataString); $.ajax({ type: "POST", url: "gen_details.php", data: dataString, success: function(data) { $("#content").hide().fadeOut('fast'); $("#content").html(data).show('fast'); refresh = 0; }, }); return false; }); </code></pre> <p>This works perfectly fine, until it reloads. It seems to lose the handle for the a href and instead of doing the procedure it goes to gen_details.php</p> <p>I have tried to use .on() but I don't know how would I get the ID of the entry using .on(), as I cant use $(this) (afaik).</p> <p>I hope I explained my problem at least half-well. English is not my first language so it wasn't that easy.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
3,158,503
3,158,504
Should I ever pass data back to a main activity?
<p>My theory is that my main activity will open <code>LoginActivity</code>, then that activity will pass the <code>User</code> back to the main activity, which would launch <code>DashboardActivity</code> and stop <code>LoginActivity</code>.</p> <p>Does this make sense or should I do this differently? I'm looking for best practice advice.</p>
java android
[1, 4]
1,620,699
1,620,700
Three Different text to call the same onclick action
<p>I have this code working alright (all thanks to all the kind assistance i have received in this medium</p> <pre><code>$htx = $row['mia_Text'] == 'mia owo'; &lt;div id='inner'&gt; &lt;p style="color:#FFF;"&gt;&lt;a href="javascript:;" onclick="pkgsPopup('&lt;?='http://'.$hLnk?&gt;');" rel='nofollow'&gt; &lt;?=$hTxt?&gt; &lt;/a&gt; &lt;/p&gt; &lt;/div&gt; &lt;/div&gt; &lt;div id='innercontent'&gt; .... </code></pre> <p>Assuming I aslo want to (apart from $htx = $row['mia_Text'] == 'mia owo') add another mia_Text like 'mia ekpo' and 'mia uman' to the same $htx onclick event, any ideas on how I can implement this?</p> <p>I really appreciate all the help. Thanks</p>
php javascript
[2, 3]
140,575
140,576
convert string to php array, jquery serialize on form
<p>I have a form and am sending the data to a backend php script using:</p> <pre><code>var fields = $('#myform').serializeArray(); </code></pre> <p>And then doing a post. Some of my inputs are named as arrays so when the data gets posted, I have an array like below. How do I convert the attribute pieces back into one attribute array with sub arrays?</p> <pre><code>[1]=&gt; array(2) { ["name"]=&gt; string(20) "attribute[26][higher]" ["value"]=&gt; string(2) "21" } [2]=&gt; array(2) { ["name"]=&gt; string(20) "attribute[27][higher]" ["value"]=&gt; string(2) "20" } </code></pre>
php jquery
[2, 5]
586,854
586,855
Comparing Java's pass-by-value with C++'s pass-by-value or -reference
<p>Java uses pass-by-value, both with Objects and primitive types. Because Java passes the value of the reference, we can change the value of target but cannot change the address.</p> <p>How does this compare with C++?</p>
java c++
[1, 6]
2,772,248
2,772,249
Update a listview when a button is pressed
<p>I have two listviews, one where the data is displayed and another where I insert data (InsertItemTemplate). When the button on the first one is clicked and data is entered in the database i want the other one to update.</p> <p>This is how i tried so far:</p> <pre><code>&lt;asp:Button ID="InsertButton" runat="server" CommandName="Insert" Text="Add movie" OnClick="InsertButton_OnClick" /&gt; </code></pre> <p>And in the aspx file:</p> <pre><code>protected void InsertButton_OnClick(object sender, EventArgs e) { Response.Redirect(Request.RawUrl); } </code></pre> <p>When i use "Response.Redirect(Request.RawUrl);" my data is not entered, so that will not work. What should I use instead to get this to work?</p> <p>Thanks in advance!</p>
c# asp.net
[0, 9]
4,165,766
4,165,767
How to hide div on click and change html in another
<p>I have a simple request(still learning javascript). I have a title div and 3 divs(with an anchor tag inside each) below it. Basically what I want, is when you click on one of the anchor tags, that that specific anchor tag should hide(actually its parent div), and the text in the Title div above should change. How can I do that? See <a href="http://jsfiddle.net/gGAW5/53/" rel="nofollow">overly simplified example</a>.</p>
javascript jquery
[3, 5]
5,808,212
5,808,213
Whats the codeURI value for ¶?
<p>Could someone please tell me what the CodeURI value of a line break is? (¶)</p> <p><strong>If you look below at the comment test you will see what i'm trying to achieve.</strong></p> <pre><code>public static string unescapeForEncodeUriCompatability(string str) { return str.Replace("%21", "!").Replace("%7e", "~") .Replace("%27", "'").Replace("%28", "(").Replace("%29", ")") .Replace("%3b", ";").Replace("%2f", "/").Replace("%3f", "?") .Replace("%3a", ":").Replace("%40", "@").Replace("%26", "&amp;") .Replace("%3d", "=").Replace("%2b", "+").Replace("%24", "$") .Replace("%2c", ",").Replace("%23", "#"); //test .Replace("¶"," ") } </code></pre>
c# javascript
[0, 3]
6,033,955
6,033,956
What are the differences between PHP and Java?
<p>What are the main differences between PHP and Java that someone proficient in PHP but learning Java should know about?</p> <p><strong>Edit:</strong> I mean differences in the syntax of the languages, i.e their data types, how they handle arrays &amp; reference variables, and so forth :)</p>
java php
[1, 2]
4,683,437
4,683,438
Why does changing the name of my function break my JavaScript?
<p>I have the following which works perfectly</p> <pre><code>$(function() { // Create the chart chart = new Highcharts.StockChart({ ... }); }); </code></pre> <p>However when I make the following modification</p> <pre><code>createCharts(); function createCharts() { // Create the chart chart = new Highcharts.StockChart({ ... }); } </code></pre> <p>I get the following error message</p> <p>Message: 'Highcharts' is undefined</p> <p>Nothing else has changed why does the above break my script?</p>
javascript jquery
[3, 5]
5,634,978
5,634,979
Setting an Image control source to an image in the server
<p>I'm trying to show an image on my Image control but it isn't working. I'm using it as a screenshot preview basically. I have the bitmap save to the Images folder in the server path, and then I set the ImageUrl for the control to that saved image location. Here is the code I have. This code executes on a button click:</p> <pre><code>img.Save(Server.MapPath("~/Images/") + "test.png", ImageFormat.Png); Image1.ImageUrl = Server.MapPath("~/Images/") + "test.png"; Image1.DataBind(); </code></pre> <p>No exceptions are caught, and the image is saving correctly in the path. </p>
c# asp.net
[0, 9]
5,259,985
5,259,986
how to debug into the java function from native call with GDB?
<p>there, I have a C++ function call into Java module like this. My question is how to debug into the java code? In the program, there is a "JNI_CreateJavaVM()" function call to create the VM and load Java class into it. And I step into below code with GDB. This is really a trick to me. Please give me some idea. Thanks very much! </p> <pre><code>void functions::call( jobject jo, const Parameter_list&amp; parameter_list ) const { Env env; env-&gt;CallVoidMethodA( jo, id(), JVALUES_CAST(parameter_list.jvalue_array()) ); if( env-&gt;ExceptionCheck() ) env.throw_java( "CallVoidMethodA" ); } jni.h: void CallVoidMethodA(jobject obj, jmethodID methodID, const jvalue * args) { functions-&gt;CallVoidMethodA(this,obj,methodID,args); } </code></pre>
java c++
[1, 6]
3,815,946
3,815,947
getting ids of different textViews defined in a class
<p>My TextView class is </p> <pre><code>static class ViewHolder { protected TextView tv0; protected TextView tv1; protected TextView tv2; protected TextView tv3; protected TextView tv4; protected TextView tv5; protected TextView tv6; protected TextView tv7; } linearview.setTag(viewHolder); linearView.setId(xyz); </code></pre> <p>// viewHolder.tv5 id will be xyz+5</p> <p>Now, I can get the whole class with view.getTag. what i want is, suppose i have a word "TEST"</p> <p>my random function selects 2 so i want tv2 = T, tv3 = E and so on. I can use str.getCharAt to get the char but how to get textViews from random word.</p> <p>Best Regards</p>
java android
[1, 4]
1,835,307
1,835,308
Jquery conflict
<p>I have been trying and trying to fix jquery issues. i have in my header lots of jquery. I use it for slider and other things that are built into this premade theme. I am unable to add anything that uses jquery because of conflict. i need some help. The board is www.cgwhat.com. The forgot password is jquery and the slider is controlled by jquery also. I wanted to add another plugin but can not because of the conflict. Also with the forgot password that is jquery. I need to know what is wrong and how to fix it . If i remove calls to javascript in header it is fixed. The forgot password works but everything else breaks. </p> <pre><code>&lt;?php wp_enqueue_script("jquery"); ?&gt; &lt;?php wp_head(); ?&gt; &lt;script type="text/javascript" src="&lt;?php bloginfo('template_url'); ?&gt;/js/jquery.equalHeight.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="&lt;?php bloginfo('template_url'); ?&gt;/js/flashobject.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="&lt;?php bloginfo('template_directory'); ?&gt;/js/jquery.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="&lt;?php bloginfo('template_directory'); ?&gt;/js/jquery.jcarousel.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="&lt;?php bloginfo('template_directory'); ?&gt;/js/jquery.actions.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; jQuery(document).ready(function($){ var fC=$('#features-nav .features-nav-item').length; curS=1; var cInt=0; cInt=setInterval(function(){ $('#features-nav .features-nav-item:eq('+curS+')').addClass('current').trigger('click'); curS++; if(curS&gt;=fC) curS=0; },10000);}); &lt;/script&gt; &lt;/head&gt; </code></pre>
jquery javascript
[5, 3]
246,581
246,582
How to pass variable from PHP to Python?
<p>How can i pass a variable from a .PHP script to Python and vice versa?. </p> <p>e.g</p> <pre><code>//myPHPScript.php $hello = 'hello'; //myPythonScript.py print(get the result from $hello variable found in myPHPScript.php) </code></pre>
php python
[2, 7]
911,787
911,788
How to combine keypress & on click function in JavaScript?
<p>I have the following two functions:</p> <pre><code>$("input").keypress(function(event) { if (event.which == 13) { //code } }); $('#login_submit').click(function () { //code }); </code></pre> <p>The code which is being used in the functions are EXACTLY the same code, basically code dublication. So i was wondering if there is a way to combine these functions with an OR statement??</p>
javascript jquery
[3, 5]
843,400
843,401
textbox in asp.net using c#
<p>Can i bind my data with textbox in asp.net using c# sorry to ask this silly question </p> <p>if yes than how to bind it as if we use VC# the text box has the option data binding in property ''</p> <p>in asp.net i am not getting it </p> <p>plz can any help me out ?</p>
c# asp.net
[0, 9]
5,982,868
5,982,869
asp.net and c# with javascript
<pre><code>((LinkButton)e.Item.FindControl("my_label_name")) .Attributes.Add("onclick","javascript:myJavaScriptFunction('" + data1_from_db + "','"+data2_from_db+"')"); </code></pre> <p>I wrote this code (this code is in my <code>default.aspx.cs</code>) and this worked successfully at <em>localhost</em> but at server didn't work. And gives no error about working. Just it doesn't work. If any incomprehensible places have, please, ask me.</p>
c# javascript asp.net
[0, 3, 9]
2,768,836
2,768,837
Programmatically call anchor tag to Page Top at load time
<p>I have a anchor tag that when you click on the "Up to the Top", it will move the web page to the top of the page. My anchor tag is #PAGETOP.</p> <p>My question is, I am using the jQuery UI Dialog and basically would like to programmatically activate this #PAGETOP anchor so whenever the page always loads at startup, would like to ensure that the page moves immediately to the top of the page.</p> <p>I would like to emulate the way stackoverflow moves to the top of all your questions when you paginate to the next page (if possible).</p> <p>Thanks.</p>
javascript jquery
[3, 5]
1,325,570
1,325,571
Use Browser Search (Ctrl+F) through a button in website?
<p>I have created a website and have added a button and lot of text. What I want is to use the browser search (Ctrl+F), when I press the button which I added in website.</p> <p>How can I achieve this?</p>
javascript asp.net
[3, 9]
4,175,903
4,175,904
iPhone / Android Apps & interacting with a website
<p>Hey guys.... just wondering does it matter much what your website is programmed in (PHP/.NET/ROR etc) with regards to having an iPhone or Android app interact with it?</p> <p>Thanks!</p>
iphone android
[8, 4]
956,478
956,479
Android JSON parsing pound symbol coming up as?
<p>I have a JSON file which contains a pound symbol in it. This json is pulled from a file stored on the phone temporarily. It will come from a server, but for time being I am just storing it on the phone. I convert the JSON file to an input stream and use a method to convert it to a string like this</p> <pre><code>Resources res = getResources(); String sJsonVariables = iStream_to_String(res .openRawResource(R.raw.widgvariables)); </code></pre> <p>The iStream_to_String method is this</p> <pre><code>public String iStream_to_String(InputStream is) { BufferedReader rd = new BufferedReader(new InputStreamReader(is), 4096); String line; StringBuilder sb = new StringBuilder(); try { while ((line = rd.readLine()) != null) { sb.append(line); } rd.close(); } catch (IOException e) { e.printStackTrace(); } String contentOfMyInputStream = sb.toString(); return contentOfMyInputStream; } </code></pre> <p>I have tried printing out the json using Log.v to test it is printing out okay. Everything prints out fine except for the pound symbol. I have tried several different ways of encoding it like this</p> <pre><code>byte []b = sJsonVariables.getBytes(); String s1 = new String(b, "UTF-8"); String s2 = new String(b, "ASCII"); String s3 = new String(b, "Cp1252"); String s4 = new String(b, "ISO8859_1"); </code></pre> <p>However none of them will print out the pound symbol, it either comes out as a black question mark or some other weird symbol. Does anyone know what I am doing wrong, and how I can get this symbol to print out properly?</p>
java android
[1, 4]
4,451,983
4,451,984
Function to get index from an array of objects having certain value of provided property
<p>My question is based on and similar to <a href="http://stackoverflow.com/q/7176908/148271">this one</a> but a little bit different because property name will be variable.</p> <p>How do I create a function which will return me index of object having certain value of provided property? </p> <pre><code>function indexOf(propertyName,lookingForValue,array){ //...... return index; } </code></pre> <p>So, </p> <pre><code>indexOf("token",123123,[ {id_list:1, name:'Nick',token:'312312'},{id_list:2,name:'John',token:'123123'} ]); </code></pre> <p>should return 1.</p> <p>The main problem I have is how do I check the property value when I have the property name as string with me?</p>
javascript jquery
[3, 5]
4,627,320
4,627,321
Jquery Ajax Problem
<p><strong>Hi all;</strong></p> <pre><code>var v_name = null; $.ajax({ type: "GET", url: "Testpage.aspx", data: "name=test", dataType: "html", success: function(mydata) { $.data(document.body, 'v_name', mydata); } }); v_name = $.data(document.body, 'OutputGrid'); alert(v_name); </code></pre> <p>first alert undefined before alert work why ?</p>
javascript jquery
[3, 5]
2,354,383
2,354,384
photo mosaics in javascript
<p>Is there any jquery plugin or a javascript library to produce photo mosaics, ie creating an image made up of smaller images ? (cf: <a href="http://en.wikipedia.org/wiki/Photographic_mosaic" rel="nofollow">http://en.wikipedia.org/wiki/Photographic_mosaic</a>)</p>
javascript jquery
[3, 5]
1,036,845
1,036,846
jQuery - use .hover instead of .click
<p>I have the following code on my page.</p> <p><a href="http://jsfiddle.net/SO_AMK/r7ZDm/" rel="nofollow">http://jsfiddle.net/SO_AMK/r7ZDm/</a></p> <p>As you see it's a list of links, and every time a link is clicked, the popup box opens up right underneath the link in question.</p> <p>Now, what I need to do is basically the same, except I need to use the .hover event and delay the execution by 2 seconds. So instead of clicking, the user should keep the cursor over a link for 2 seconds.</p> <p>Sounds simple enough but I can't get the positioning to work properly. here's what I tried:</p> <pre><code>$('a.showreranks').hover(function() { $(this).data('timeout', window.setTimeout(function() { position = $(this).position(); $('#rerank_details').css('top', position.top + 17); $('#rerank_details').slideToggle(300); }, 2000)); }, function() { clearTimeout($(this).data('timeout')); }); </code></pre> <p>Can someone modify this to make it work?</p>
javascript jquery
[3, 5]
1,890,502
1,890,503
saving Image using sql query method
<p>I am using following code: Note that i HAVE TO SEND SQL Query so using this procedure.</p> <p><code>currentReceipt.image</code> is a <code>byte[]</code></p> <pre><code> String updateQuery = "INSERT INTO MAReceipts(userId, transactionId, transactionType, receiptIndex, referenceNo, image, smallThumb, comments, createdOn, updatedOn) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"; java.util.Date today = new java.util.Date(); long t = today.getTime(); java.sql.Date now = new java.sql.Date(t); for(int i = 0; i &lt; receipts.size(); i++) { try{ Receipt currentReceipt = receipts.get(i); String[] valVars = { stringToDB(transaction.userId), integerToDB(transaction.transactionId), integerToDB(transaction.transactionType.getValue()), integerToDB(i), stringToDB(currentReceipt.referenceNo), (currentReceipt.image != null ? imageToDB(currentReceipt.image): "null"), (currentReceipt.smallThumb != null ? imageToDB(currentReceipt.smallThumb): "null"), // NEED TO CHANGE THIS TO SMALL THUMB stringToDB(currentReceipt.comments), dateToDB(now), dateToDB(now) }; mDb.execSQL(updateQuery, valVars); }catch (Exception e){ Log.e("Error in transaction", e.toString()); return false; } } public String imageToDB (byte[] image) { String convertedImage = image.toString(); return convertedImage; } </code></pre> <p><code>return convertedImage</code> shows a value of <code>[B@43eb4218</code> or similar to that.</p> <p>Now this data is saved in database. Please tell me is the image is correctly saving in database and can i retrieve it? If not then any preferable way , do tell me.</p> <p>Best Regards</p>
java android
[1, 4]
3,470,763
3,470,764
why java script cannot access this asp.net var?
<p>I have this c# user control class:</p> <pre><code>public partial class UserControls_JsTop : System.Web.UI.UserControl { public static string sidebarBannerUrl = getSideBarBannerImgUrl(); protected void Page_Load(object sender, EventArgs e) { } public static string getSideBarBannerImgUrl(){ DataClassesDataContext db = new DataClassesDataContext(); var imgUrl = (from b in db.Banners where b.Position.Equals(EBannersPosition.siderbar.ToString()) select b).FirstOrDefault(); if (imgUrl != null) return imgUrl.Path; return String.Empty; } } </code></pre> <p>I try to acces the static var in a js script:</p> <p>load it here:</p> <pre><code>&lt;script type="text/javascript"&gt; var categoryParam = '&lt;%# CQueryStringParameters.CATEGORY %&gt;'; var subcategory1Param = '&lt;%# CQueryStringParameters.SUBCATEGORY1_ID %&gt;'; var subcategory2Param = '&lt;%# CQueryStringParameters.SUBCATEGORY2_ID %&gt;'; var imgUrl = '&lt;%# UserControls_JsTop.sidebarBannerUrl %&gt;'; &lt;/script&gt; </code></pre> <p>and use it here (imgUrl):</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; $(function () { $(document.body).sidebar({ size: "30px", // can be anything in pixels length: "270px", // can be anything in pixels margin: "300px", // can be anything in pixels position: "left", // left / bottom / right / top fadding: "0.8", // 0.1 to 1.0 img: imgUrl, openURL: "www.twitter.com/amitspatil" }); }); &lt;/script&gt; </code></pre> <p>I do not understand why it is empty. Please trust me that there is a record in DB with that condition.</p> <p>I think there is some js problem when loading the var...</p> <p>Do you know where?</p> <p>thanks</p>
c# asp.net jquery
[0, 9, 5]
2,983,228
2,983,229
Dynamically Draggable, Editable and self resizing TextField
<p>I'm working on an android app in Eclipse and I need a textfield that can be placed, dragged, and edited by the user on screen. Now I have this working on an absolute layout, which is fine, and I have editing capabilities but I'm looking for something more along the line of how Skitch by evernote does it. has anyone got any ideas or suggestions on how to get that kind of textfield functionality going.</p> <p>Thanks in advance. Will recommend any answer that leads in the right direction.</p>
java android
[1, 4]
5,133,597
5,133,598
Replace or remove nth occurrence of \n
<p>This is my string:</p> <pre><code>var ok = "\n\n33333333333\n\n\n"; </code></pre> <p>How to replace the 4th occurence of '\n' with ''? Or, how to remove the 4th occurence of '\n'?</p>
javascript jquery
[3, 5]
4,618,378
4,618,379
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed
<p>I have a grid view on my page and i want to export it to the Excel Sheet, Below is the code i had written to do this task, here i am already passing the dataset to the method to bind the grid and btnExcelExport is the button which will export the Grid Content in to Excel Sheet :-</p> <pre><code>private void BindGridView(DataSet ds) { if (ds.Tables.Count &gt; 0) { if (ds.Tables[0].Rows.Count &gt; 0) { GVUserReport.DataSource = ds; GVUserReport.DataBind(); btnExcelExport.Visible = true; } } } protected void btnExcelExport_Click(object sender, EventArgs e) { Response.Clear(); Response.AddHeader("content-disposition", "attachment;filename=FileName.xls"); Response.Charset = ""; Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.ContentType = "application/vnd.xls"; System.IO.StringWriter stringWrite = new System.IO.StringWriter(); System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite); GVUserReport.RenderControl(htmlWrite); Response.Write(stringWrite.ToString()); Response.End(); } public override void VerifyRenderingInServerForm(Control control) { return; } </code></pre> <p>Now when i m debugging i found that the grid is binded sucessfully but when trying to export it to Excel , i m getting this Error "Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed."</p>
c# asp.net
[0, 9]
1,558,729
1,558,730
Best practice to save data for anonymous users?
<p>I'm building a web app and i'd like to allow anonymous users to use it and to save some data without signing up.</p> <p>let's assume the user save a list of favorites image urls without singing up.</p> <p>now i'm using this way: I save those favs in db and then i save the user's ip address so every time the user go back he can see his past favs</p> <p>of course this is a temp solution</p> <p>what's the best way to associate that list to a specific user? save it in a cookie? some hybrid solution?</p>
php javascript
[2, 3]
3,800,611
3,800,612
jQuery function not moving... can't find anything wrong with it?
<p>I'm trying to take these moving clouds: <a href="http://vintageskytheme.tumblr.com/" rel="nofollow">http://vintageskytheme.tumblr.com/</a> (it's a theme I've already bought from themeforest, but its for tumblr)</p> <p>I'm trying to put it on wordpress. here: <a href="http://pawprintsinmypancakes.com/" rel="nofollow">http://pawprintsinmypancakes.com/</a></p> <p>it used to be $() function and i see it giving errors in console every 30 milliseconds so i know the rest of the code IS working... but when i change it to jQuery()... console is just silent. I have no idea whats wrong</p>
javascript jquery
[3, 5]
2,424,043
2,424,044
how to refrence Linq2SQL class from a static class
<p>i am having a strange problem, i have a static class like this </p> <pre><code> public static class BlogDataAccess { private static Blog _Blg; public static Blog Blg { get { _Blg = new Blog (); return _Blog ; } } } </code></pre> <p>then in my page i do the following</p> <pre><code> var DataContext= new DataClasses(); BlogDataAccess.Blg.ArticleTitle ="Title"; DataContext.Blog.InsertOnSubmit(BlogDataAccess.Blg); DataContext.SubmitChanges(); </code></pre> <p>the record get inserted but with null value of the ArticleTitle field thanks in advanced.</p>
c# asp.net
[0, 9]
330,787
330,788
Javascript alert based on specific selected inputs (drop down lists)
<p>I have very limited Javascript knowledge so require some help please:</p> <p>I have the following function:</p> <pre><code>$('#addDialog').dialog({ autoOpen: false, width: 500, buttons: { "Add": function() { //alert("sent:" + addStartDate.format("dd-MM-yyyy hh:mm:ss tt") + "==" + addStartDate.toLocaleString()); var eventToAdd = { //title: $("#addEventName").val(), title: $("#addEventSalesPerson option:selected").text(), description: $("#addEventDesc").val(), start: addStartDate.format("dd-MM-yyyy hh:mm:ss tt"), end: addEndDate.format("dd-MM-yyyy hh:mm:ss tt"), salesperson: $("#addEventSalesPerson option:selected").text(), eventPostCode: $("input[id$=addEventPostCode]").val(), eventname: $("#addEventEventName option:selected").text() }; if ($("input[id$=addEventPostCode]").val().length &lt; 5) { alert("Post code cannot be blank and must contain a minimum of 5 characters"); } else { //alert("sending " + eventToAdd.title); PageMethods.addEvent(eventToAdd, addSuccess); $(this).dialog("close"); } } } }); </code></pre> <p><code>#addEventEventName</code> is a DDL populated from SQL and has several options. Currently, if the <code>"input[id$=addEventPostCode]"</code> has less than 5 characters then it gives an Alert.</p> <p>What I need is, If the Selected Option is <em>Holiday</em> or <em>Sickness</em> then it does not display an alert. Thanks</p> <p><strong>Update</strong> I tried adding the following line as per @David's suggestion but still no joy - any takers?</p> <pre><code>if ($("input[id$=addEventPostCode]").val().length &lt; 5 &amp;&amp; !($("#addEventSalesPerson option:selected").text() == "Holiday" || $("#addEventSalesPerson option:selected").text() == "Sickness")) { </code></pre>
javascript jquery
[3, 5]
1,976,069
1,976,070
loading, scrolling , zoom in and zoom out the images like google map
<p>I am working on a web application. i just wanna know the way to do it. its just like a map application, but not the map.</p> <p>i need to display 100 images on the webpage inside a div from mysql database. each image would display on a specific predefine tile. i wants the following functionalists. </p> <ol> <li>loading of the images(not the all image)</li> <li>zoom in and zoom out. update the images like a map.</li> <li>scrolling. update the images like a map.</li> </ol> <p>a. my div can only displays 25 images. i wants to load only 25 images in that area. remaining images should load on scroll or zoom in and out.</p> <p>b. if user clicks on "zoom in" then it should load and shows the next layer of big images like in google map and if i click on zoom out then it shows the previous layer of small images.</p> <p>can anyone give me the idea how to build this application. I have checked OpenLayers, geo server and ajax-zoom already. i dont wants to go for geo-server as its not the mapping application. but i need the same functionality of map. shall i use jquery plugins to do this.</p> <p>Please help</p> <p>Regards, Asif Hameed</p>
php javascript jquery
[2, 3, 5]
4,619,571
4,619,572
Jquery inline attribute value
<p><strong>Can i get some suggestions. Do you have better way to do this?</strong></p> <p>Most of the time when i got a group of data input in Html table, I always level data like some reference id like "student_id", or "country_id" to parent structure like or , </p> <p>for example</p> <pre><code>&lt;tr student_id="1" subject_id="2" school_id="5" country_id="6"&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; ..... ...... &lt;/tr&gt; .... ..... &lt;tr student_id="43" subject_id="35" school_id="22" country_id="411"&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; ..... ...... &lt;/tr&gt; .... ..... </code></pre> <p>when i call javascript function i can get and get those id in function</p> <pre><code>var tr = $(this).closest('tr'); var student_id = $(this).attr('student_id'); var subject_id = $(this).attr('subject_id'); var school_id = $(this).attr('school_id'); ....... </code></pre> <p>Do you got better way to store these kind of reference ? Thanks.</p>
javascript jquery
[3, 5]
2,668,411
2,668,412
Add onMouseOver Javascript Function to Asp.Net Dynamic Menu Items
<p>How do you add a mouseover javascript function to an asp.net menu item when the menu items are created dynamically? Doesn't allow you to add .attributes function.</p> <p>[Javasript]</p> <pre><code>&lt;script type="text/javascript"&gt; function ChangeProjectImage(obj) { var ctrl = document.getElementById(obj.id); ...code... } &lt;/script&gt; </code></pre> <p>[HTML - Menu Control]</p> <pre><code>&lt;asp:Menu ID="Menu1" runat="server" Orientation="Vertical" Font-Names="Verdana" Font-Size="12px" CssClass="Menu"&gt; &lt;/asp:Menu&gt; </code></pre> <p>[CodeBehind - Add menu items dynamically]</p> <pre><code>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Me.IsPostBack Then Else Dim dt As DataTable = Session("dt") For Each dr As DataRow In dt.Rows Dim mi As New MenuItem(dr(0), dr(1), "images\folder_03.png") Menu1.Items.Add(mi) Next End If </code></pre>
javascript asp.net
[3, 9]
166,548
166,549
Creating DIV dynamically, is not taking height and width on fly
<p>I want to create div dynamically based on some calculations.I am able build div's dynamically but the only issue is it's not taking height and width on fly.please any one share their view or code if possible.</p> <p>Here's the script which i used for your reference.</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; function createDiv() { var totalheight=400; var totalwidth = 600; var height = 80; var width = 40; var divheight = totalheight / height; var divwidth = totalwidth / width; var id=1; for(var i=1;i&lt;=divheight;i++) { var eh=divwidth; var fh=1; for (var w = 1; w &lt;= divwidth; w++) { var div=document.createElement("&lt;div id='"+id+"' style=\"background:#F0E68C;width:'"+width+"'px;height:'"+height+"'px;border:solid 1px #c0c0c0;padding: 0.5em;text-align: center;float:left;\"&gt;&lt;/div&gt;"); document.body.appendChild(div); eh=eh+divheight; fh=fh+divheight; id++; } var div1=document.createElement("&lt;br/&gt;"); document.body.appendChild(div1); } } &lt;/script&gt; </code></pre> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
4,291,775
4,291,776
Jquery clear form in a section
<p>for the following:</p> <pre><code>&lt;div class="section grouping"&gt; &lt;div class="sectionControl"&gt; &lt;div class="parent row errorOn"&gt; &lt;div class="validGroupControl"&gt; &lt;div class="row2 itemWrap clearfix"&gt; &lt;label&gt;Login1 (adress e-mail)&lt;span class="iconReq"&gt;&amp;nbsp;&lt;/span&gt;:&lt;/label&gt; &lt;input type="text" class="text"&gt; &lt;/div&gt; &lt;div class="itemWrap clearfix"&gt; &lt;label&gt;Input field1&lt;span class="iconReq"&gt;&amp;nbsp;&lt;/span&gt;:&lt;/label&gt; &lt;input type="password" class="text"&gt; &lt;/div&gt; &lt;a href="#" class="iconClose" onclick="$(this).closest('div.parent').remove();" title="remove"&gt;remove&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;div class="row addControl"&gt; &lt;a href="#" class="button" onclick="$('div.sectionControl').append($('div.sectionControl div.parent:last').html());"&gt;Add&lt;/a&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>when I run this:</p> <pre><code>$('div.addControl a.button').click(function () { var parent = $(this).closest('.section.grouping').find('.parent:last'); parent.after(parent.clone()); }); </code></pre> <p>it clones 'parent' section which works great. But i want it to clone it without values in the input fields. </p> <p>what's the best way to clear all input fields in a section? thanks</p>
javascript jquery
[3, 5]
1,328,073
1,328,074
If it's inside the variable
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1789945/javascript-string-contains">JavaScript: string contains</a> </p> </blockquote> <p>I have a simple question for you. I have a variable with my url. Now i want check this url. I make this javascript:</p> <pre><code>var url = "http://www.mikevierwind.nl"; if(url == "localhost" ) { alert("test"); } </code></pre> <p>How can i make the follow thing. When mikewind is in variable. Than run it. The variable can also be mikevierwind.be and mikevierwind.eu. But the script must always than run. I must check of mikevierwind is in the variable.</p>
javascript jquery
[3, 5]
2,362,062
2,362,063
Getting the source of a click in jquery?
<pre><code>var currentImageBox; $('.newImage').bind('click', function() { currentImageBox = this; currentImageBox.unbind('click'); }); </code></pre> <p>Im trying to set currentImageBox to the div that was clicked (a number of divs on the page have the newImage class). But to no avail, where am I going wrong?</p>
javascript jquery
[3, 5]
2,681,235
2,681,236
send the form information to my email box with php
<pre><code>&lt;input type="button" class="button" /&gt; &lt;form action="" method=""&gt; &lt;input type="text" name="name" /&gt; &lt;input type="text" email="email" /&gt; &lt;input type="text" phone="phone" /&gt; &lt;textarea name="message"&gt;&lt;/textarea&gt; &lt;input type="submit" class="submit"/&gt; &lt;/form&gt; </code></pre> <p>1,click the button, then popup the form, after the user fills out all the information in the form than click the submit button, send all the form information to my eamil box.</p> <p>how to write the action part. and which method should i use? should i use mail function to send the email or other ways?</p> <p>i may use jquery to pop up the form window, but i don't know how to collect the form information,then send it my email box.</p>
php jquery
[2, 5]
5,160,924
5,160,925
Initializing jquery ui plugins using live or on jquery
<p>I want to initialize <code>jquery ui button plugin</code> using <code>live</code> or <code>on</code>. Means something like :</p> <pre><code> $('button').live("which event", function() { $(this).button(); }); </code></pre> <p>But i don't know the event which i can use in this place. I tried <code>load</code> and <code>ready</code> but not works. Then i tried <code>custom event</code> also :</p> <pre><code> $('button').live("event", function() { $(this).button(); }); $('button').trigger('event'); </code></pre> <p>This also not works.Help me out please !</p>
javascript jquery
[3, 5]
3,328,164
3,328,165
Variable passed into .on() function always is the last element
<p>I'm sort of emulating Backbone's event system with an object like this:</p> <pre><code>var events = { 'click .one': 'fnOne', 'click .two': 'fnTwo', 'click .three': 'fnThree' } </code></pre> <p>Then to set the event listeners with jquery I'm using the following:</p> <pre><code>var method, match, event_name, selector; var scope = { // Complex object literal passed to the event's // function for access... }; var delegateEventSplitter = /^(\S+)\s*(.*)$/; for (key in events) { if (events.hasOwnProperty(key)) { method = events[key]; match = key.match(delegateEventSplitter); event_name = match[1]; selector = match[2]; $('#element').on(event_name,selector,function(event){ method(event,scope); }); } } </code></pre> <p>The problem I'm having is that it's binding correctly except all of the events fire the last function <code>fnThree</code></p>
javascript jquery
[3, 5]
4,547,860
4,547,861
DatePicker inside asp.net gridview not displaying?
<p>I've got an asp.net gridview inside an updatepanel. One of the fields I have on there is a simple textbox like so:</p> <p><code>&lt;asp:TextBox ID="txtDueDate" Text='&lt;%# Eval("DueDate") %&gt;' Width="75px" runat="server" ToolTip="Select the due date." CssClass="datePickerDueDate"&gt;&lt;/asp:TextBox&gt;</code></p> <p>I want the jquery ui datepicker to appear when I click on this text box, I tried:</p> <pre><code> $(".datePickerDueDate").datepicker({ }); </code></pre> <p>In chrome developer tools this textbox's id appears as: <code>id="MainContent_gvLineItems_txtDueDate_0"</code> What is the best way to handle this? My current issue is the calendar does not appear UNLESS I open developer tools and enter it directly in the console window and hit enter.</p> <h2>Edit</h2> <p>I can solve it with this:</p> <p><code>ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "setDueDate", "$(function(){$('.datePickerDueDate').datepicker('option' 'firstDay', 1);});", true);</code></p> <p>In code behind but this appears to be ugly...is there a better way?</p>
jquery asp.net
[5, 9]
2,667,484
2,667,485
How to tell onBlur not to hide the submit button when clicked?
<p>My blur event hides the submit button; but doing that seems to cancel the submit event. I only want to hide when the submit itself wasn't clicked. How can I determine if the focus was lost due to the submit, or due to just wandering off elsewhere?</p> <pre><code>&lt;form action="" method="post"&gt; &lt;textarea id="message" name="message"&gt;&lt;/textarea&gt; &lt;input type="submit" id="share" value="Share"&gt; &lt;/form&gt; ... $('textarea').blur(function(){ $('#share').hide() }) $('textarea').focus(function(){ $('#share').show() }) </code></pre> <p>Setting a timeout to allow the submit event to fire before coming back to the blur seems a bit hacky to me. Can't we do better than that? Can I tell the blur not to block other events? or search the dom for a pending submit event? or ... ?</p> <hr> <p><strong>Solution</strong> </p> <p>for today is based on the ticked answer, but simpler. Use jquery's "fadeOut" routine to</p> <ol> <li>delay the hidden status of the submit button until after the submit event has fired, and </li> <li>make the user feel like their submission is being handled</li> </ol> <p>.</p> <pre><code>$('textarea').blur(function(){ $('#share').fadeOut() }) $('textarea').focus(function(){ $('#share').fadeIn() }) </code></pre> <p>It's indirect, and not really what I was looking for, but it seems clear that direct manipulation of the event queue - such as writing onBlur to say "if they did not click submit then hide the submit button" - is perhaps not technically possible.</p>
javascript jquery
[3, 5]
4,396,497
4,396,498
Forms in ModalPopupExtender in ASP.net c#
<p>I am currently working on an ASP.net c# project. I have an aspx page where I have a form taking user input and a datagrid. When the user clicks on a link inside the datagrid it displays a modal popup extender with dynamic data. This is working fine. </p> <p>What I want to be able to do is when the modal popup extender is opened it has a form that can also take user input. However, I am having a problem that when I try to enter data into the form in the modal popup extender and i press the submit button it is first checking the form on the proper page, not in the modal popup extender, which is preventing the form on the modal popup extender from being submitted.</p> <p>How can I get around this issue. Any help would be greatly appreciated. Thank you</p>
c# asp.net
[0, 9]
1,921,905
1,921,906
ConfigurationSection with multiple projects
<p>In my asp.net solution i have a couple of class library-projects that act as modules of the site.<br> In main project I have SiteConfigurationSection class that derives from ConfigurationSection. </p> <p>I want all projects to be able to access and use this SiteConfigurationSection.<br> But class library projects can't access it because they obviously don't have a reference to the website itself.</p> <p>Should create a special library-project for SiteConfigurationSection of maybe it's better to create a mini SiteConfigurationSection class in every project and encapsulate only the needed values?</p>
c# asp.net
[0, 9]
5,202,840
5,202,841
Calling JavaScript Function From CodeBehind
<p>I am new to JavaScript Programming and C# Programming. Can someone provide good examples of calling a Javascript function From CodeBehind and ViceVersa.</p> <p>Thank You</p>
c# javascript asp.net
[0, 3, 9]
4,864,142
4,864,143
How to send key event to an edit text in android app
<p>For example, send a backsapce key to the edit text control to remove a charactor or send a char code like 112 to append a charactor in the edittext control programatically.</p> <p>Actually I need a method like</p> <pre><code>onKeyReceived(int keyCode) { // EditText to append the keyCode, I know how to add a visible charator, but what about some special keys, like arrow key, backspace key. } </code></pre>
java android
[1, 4]
759,697
759,698
ClassCastException when getting the selected item of ListView as string or textview
<p>I got <strong>runtime error</strong> exception: </p> <pre><code>java.lang.ClassCastException: android.widget.TwoLineListItem cannot be cast to android.widget.TextView </code></pre> <p>My Activity extends Activity <strong>NOT</strong> ListActivity and here is my layout construction:</p> <pre><code>&lt;LinearLayout ...&gt; &lt;ListView ...&gt;&lt;/ListView&gt; &lt;/LinearLayout&gt; </code></pre> <p><strong>Java:</strong></p> <pre><code> ListView lv1 = (ListView) findViewById(R.id.listViewXMLdata); ArrayAdapter&lt;String&gt; arrAdapter = new ArrayAdapter&lt;String&gt;(this, android.R.layout.simple_list_item_2, android.R.id.text2, getResources().getStringArray(R.array.countries)); lv1.setAdapter(arrAdapter); lv1.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { lView.getItemAtPosition(position); String itemSelected = ((TextView) view).getText().toString(); Toast.makeText(getApplicationContext(), "Clicked Position Number " + position + ": " + itemSelected , Toast.LENGTH_SHORT) .show(); } }); </code></pre> <p>My only main concern is just to get the string (item selected) on my list.</p> <p><strong>NOTE 1</strong>: I am not working on any database.</p> <p><strong>NOTE 2</strong>: I already tried casting it to CharSequence itemSelected = ((TextView) view).getText().toString() but still got runtime error.</p> <p>The runtime error occurs only when I started to select item on the list.</p>
java android
[1, 4]
2,651,472
2,651,473
move cursor to the beginning of the input field?
<p>when you click on 'Ask question' here in Stackoverflow you see a text "What's your programming question? Be descriptive."</p> <p>i want the same thing and all i need for that is to move my cursor to the beginning of the text field. how do i do that with jquery?</p>
javascript jquery
[3, 5]
861,394
861,395
Open window by window.open and print it with window.print on load
<p>I have some code like </p> <pre><code>var windowObject = window.open('','windowObject','arguments...'); windowObject.document.write("&lt;html&gt;&lt;body onload="alert(1);window.print();alert(2);"&gt;&lt;div&gt;some html&lt;/div&gt;&lt;/body&gt;&lt;/html&gt;"); </code></pre> <p>The problem is that everything works except the window.print event (on ie, on firefox, it's working).</p> <p>Is there a workaround?</p> <p>Thanks in advance, Gaurav</p>
javascript jquery
[3, 5]
1,712,426
1,712,427
How do I handle this jquery loop?
<p>I have an array of images that I want to loop through infinitely ie. 1, 2, 3, 1, 2, 3...</p> <p>At first, I tried to do this using the following code:</p> <pre><code>var images = [ "/images/image1.jpg", "/images/image2.jpg", "/images/image3.jpg" ]; var obj = { currentValue: 0 }; var maxValue = 2; //loop through the items var infiniteLoop = setInterval(function() { if(obj.currentValue == maxValue) { obj.currentValue = 0; } // ... Code to fade in currentItem ... obj.currentValue++; }, 5000); </code></pre> <p>I'd read that this is correct method of passing in a variable by reference but for some reason, I'm never able to set the obj.currentValue back to 0 when all the images have been looped through.</p> <p>I figured an alternative way would be to set the value of an html field:</p> <pre><code>var images = [ "/images/image1.jpg", "/images/image2.jpg", "/images/image3.jpg" ]; var maxValue = 2; //loop through the items var infiniteLoop = setInterval(function() { if(parseInt($('#currentItem').val()) == maxValue) { $('#currentItem]').val('0'); } //... code to fade in currentItem ... var tmp = parseInt($('#currentItem').val()); tmp++; $('#currentItem').val(tmp); }, 5000); &lt;input type="hidden" id="currentItem" name="currentItem" value="0" /&gt; </code></pre> <p>However I'm still having the same problem. For some reason, whenever I hit the end of the image list, I'm unable to set the value of the hidden field and my infinite loop never gets to restart.</p> <p>Am I missing something obvious here? I can't seem to figure out how to get this working.</p> <p>If anyone has a more efficient method of achieving this I'd also be very grateful if you could share it :-)</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,306,646
3,306,647
how to remove a part of a url from a url using jquery?
<p>I have a javascript variable</p> <pre><code>var url = http://www.abc.it/it/security/security.aspx?security=pdfcompare&amp;../securitycomparepdf/default.aspx?SecurityTokenList=blab]2]0]blab$ALL|blab]2]0]blab$ALL|blab]2]0]blab$ALL; </code></pre> <p>I need to remove the part <code>"../securitycomparepdf/default.aspx?"</code> from it using jquery, so that the variable becomes </p> <pre><code>http://www.abc.it/it/security/security.aspx?security=pdfcompare&amp;SecurityTokenList=blab]2]0]blab$ALL|blab]2]0]blab$ALL|blab]2]0]blab$ALL; </code></pre> <p>Can someone please suggest?</p> <p>Thanks</p>
javascript jquery
[3, 5]
5,173,674
5,173,675
Whether there is something similar to strip_tags in Java?
<p>We have a function <a href="http://php.net/manual/en/function.strip-tags.php" rel="nofollow"><code>strip_tags</code></a> in PHP which would strip all the tags and also you can exempt certain tags from being stripped out..</p> <p>My question is whether there is anything similar in Java??</p>
java android
[1, 4]
3,093,537
3,093,538
Issue with text area key down event using jQuery
<p>We're having problems trying to implement a word counter similar to the one on twitter which decrements when the user types in the text field. Unfortunately it's quite glitchy as once you've deleted all the characters via backspace it displays that you only have 84 characters left (unless you hit backspace again). If you it the delete button the counter goes down even when it has removed nothing from the screen at the end of the text(I'm guessing it removes the 'invisible' character that is causing it to say 84 instead of 85 in the example before). All I want if for it to operate like the one on twitter</p> <pre><code>/* Limit textarea for cancelation policy to 85 characters*/ $('.counter').text(85-($('#txtCpolicy').val().length)); $('#txtCpolicy').keydown(function(e) { var current = $(this).val().length; $('.counter').text(85 - ($('#txtCpolicy').val().length)); if(current &gt;= 85) { if(e.which != 0 &amp;&amp; e.which != 8) { e.preventDefault(); } } }); </code></pre> <p>Hope you can help</p>
javascript jquery
[3, 5]
3,866,400
3,866,401
How to get the values from Dictionary type SESSION Variable in C#
<p>I am using C#.</p> <p>I have got below format values in my <strong>SESSION variable ["FROMDATA"]</strong>, I am using <strong>DICTIONARY</strong> to store the FORM Posted Data. Please see the related <a href="http://stackoverflow.com/questions/4723240/how-to-store-all-the-form-posted-data-in-asp-net-dictionary">question</a>.</p> <p>Below are the some values in my SESSION Variable.</p> <pre><code>1) key - "skywardsNumber" value-"99999039t" 2) key - "password" value-"a2222222" 3) key - "ctl00$MainContent$ctl22$FlightSchedules1$ddlDepartureAirport-suggest" value-"London" 4) key - "ctl00$MainContent$ctl22$ctl07$txtPromoCode" value-"AEEGIT9" . . ....so on </code></pre> <p>Now I want to <strong>create a CLASS</strong> with <strong>METHOD</strong> in it, in which I will just pass the <strong>"KEY"</strong> and it will first check it for <strong>NULL OR EMPTY</strong> and then it will <strong>return its value from the SESSION Variable ["FROMDATA"]</strong>.</p> <p>Please suggest <strong>using C#</strong>.</p>
c# asp.net
[0, 9]
2,754,139
2,754,140
Tips and Suggestion on how to create a quiz using php and jQuery
<p>I do want to create a Quiz like on this site </p> <blockquote> <p><a href="http://www.fatihacet.com/lab/jQuiz/" rel="nofollow">Quiz</a></p> </blockquote> <p>How can I done this using php and jQuery? or is there other way to do this not using flash </p> <p>I do got a idea from this and my problem is how to implement the timer with this</p> <pre><code>http://stackoverflow.com/questions/4464406/creating-a-quiz-with-jquery/4465616#4465616 </code></pre> <p>answer and made by @Fatih</p>
php jquery
[2, 5]
3,444,444
3,444,445
JQuery events get unbound when I delete and re-add them
<p>I'm creating a custom view with sorting capabilities and has something that almost works, except that once it sorts once the click events to the elements being sorted become unbound, likely as a result of how i remove the elements and re add them sorted.</p> <p>Is there a better way to do this such that the 'children' keep the bound events?</p> <pre><code>function sortcontainer(container, sortby) { alert(container.data("sessionlist").datetimesort); var children = container.children(); children.sort(function (a, b) { if (sortby == "datetime") { if (!$(a).attr("starttime")) return -1; else if (!$(b).attr("starttime")) return 1; else if (container.data("sessionlist").datetimesort) return $(a).attr("starttime") - $(b).attr("starttime"); else return $(b).attr("starttime") - $(a).attr("starttime"); } }); // End sort function container.empty(); container.html(children); if (sortby == "datetime") container.data('sessionlist').datetimesort = !container.data('sessionlist').datetimesort; } </code></pre>
javascript jquery
[3, 5]
1,666,667
1,666,668
Store detail data in JavaScript
<p>I have a Parent/Child form. For example, the parent table may have the following field</p> <ol> <li>Number of projects completed</li> <li>Have you ever worked with our company? (Yes/No radio button)</li> </ol> <p>If the second option have 'Yes' value, then I need to fill the details form. For example: "The project name done with our company, copy of contract to be uploaded etc."</p> <p>I have the following logic, The deatils form may have a ADD button to add deatils records. I think I can store the details data in JavaScript arrays? Can I store the </p> <pre><code>&lt;input type="file" name="file_to_upload" /&gt; </code></pre> <p>in arrays ?</p> <p>Then on the submit button, send the parent and child deatils to the database. Is there any other method to accomplish the task ? Please see the screen snap <img src="http://i.stack.imgur.com/aITum.png" alt="enter image description here"></p> <p><strong>I can only add one detail records at a time. My question is, where should I temporarily store the deatil list ?</strong></p>
php javascript
[2, 3]
1,652,787
1,652,788
Why does $('#id') return true if id doesn't exist?
<p>I always wondered why jQuery returns true if I'm trying to find elements by id selector that doesnt exist in the DOM structure.</p> <p>Like this:</p> <pre><code>&lt;div id="one"&gt;one&lt;/div&gt; &lt;script&gt; console.log( !!$('#one') ) // prints true console.log( !!$('#two') ) // is also true! (empty jQuery object) console.log( !!document.getElementById('two') ) // prints false &lt;/script&gt; </code></pre> <p>I know I can use <code>!!$('#two').length</code> since length === 0 if the object is empty, but it seems logical to me that a selector would return the element if found, otherwise <code>null</code> (like the native <code>document.getElementById</code> does).</p> <p>F.ex, this logic can't be done in jQuery:</p> <pre><code>var div = $('#two') || $('&lt;div id="two"&gt;&lt;/div&gt;'); </code></pre> <p>Wouldnt it be more logical if the ID selector returned null if not found?</p> <p>anyone?</p>
javascript jquery
[3, 5]
4,284,058
4,284,059
make refresh without refreshing the all page
<p>I made 2 dropdownlists which are filled from my database. In the first drop are countries and in the second are cities. When a user selects a country automatically in the second drop down appears all the cities from that country. The problem is that when I select another country all the page is refreshing and I want just that 2 drop down lists to do the refresh. I'm using Javascript and PHP. Here are the codes:</p> <pre><code>@$cat=$_GET['cat']; $quer2=mysql_query("SELECT DISTINCT category,cat_id FROM category order by category"); if(isset($cat) and strlen($cat) &gt; 0){ $quer=mysql_query("SELECT DISTINCT subcategory FROM subcategory where cat_id=$cat order by subcategory"); }else{$quer=mysql_query("SELECT DISTINCT subcategory FROM subcategory order by subcategory"); } echo "&lt;select name='cat' onchange=\"reload(this.form)\"&gt;&lt;option value=''&gt;Select one&lt;/option&gt;"; while($noticia2 = mysql_fetch_array($quer2)) { if($noticia2['cat_id']==@$cat){echo "&lt;option selected value='$noticia2[category]'&gt;$noticia2[category]&lt;/option&gt;"."&lt;BR&gt;";} else{echo "&lt;option value='$noticia2[cat_id]'&gt;$noticia2[category]&lt;/option&gt;";} } echo "&lt;/select&gt;"; echo "&amp;nbsp&amp;nbsp"; echo "&lt;select name='subcat'&gt;&lt;option value=''&gt;&lt;/option&gt;"; while($noticia = mysql_fetch_array($quer)) { echo "&lt;option value='$noticia[subcategory]'&gt;$noticia[subcategory]&lt;/option&gt;"; } echo "&lt;/select&gt;"; </code></pre> <p>and this is the Javascript code:</p> <pre><code>function reload(form) { var val=form.cat.options[form.cat.options.selectedIndex].value; self.location='index.php?cat=' + val ; } </code></pre> <p>I want that when I change the country the all page doesn't refresh only those 2 drop down lists. Any help will be much appreciated. </p>
php javascript
[2, 3]
1,762,750
1,762,751
jquery .slidetoggle() and .toggle() together, first click does nothing then works after that
<p>I'm trying to create an accordion-like interface but multiple sections can be open at once. Also, in addition to expanding a section of content for viewing, I'm swapping the image for the "header" that was clicked. Everything is working but the first click on each "header" does nothing. Each subsequent click works as expected.</p> <p>Here's a link to a fiddle that I set up: <a href="http://jsfiddle.net/kJ8t6/5/" rel="nofollow">http://jsfiddle.net/kJ8t6/5/</a></p> <p>Any help would be very much appreciated. I'm been trying to figure this out since yesterday and have to move onto other things.</p> <p>Thanks in advance.</p>
javascript jquery
[3, 5]
5,230,052
5,230,053
Clean way to detect if a Java library is being used on Android
<p>What is a good way to detect inside a Java library, if it is being used on the Android platform?</p>
java android
[1, 4]
6,032,727
6,032,728
How to show data from database in Data List Control
<p>I have a project in which I am working on admin interface . In admin interface I have to do following work.</p> <ul> <li><p>Allow user to select table in which he want to perform action(delte,show,update).</p></li> <li><p>While saving user information. i am saving the image path. and i have to also so a user image in admin interface in respect to userid.</p></li> </ul> <p>The problem is that I have save image path. and i have to show image in data list control. Can any one suggest how can I perform this task? I have to use data list through source code.</p>
c# asp.net
[0, 9]
1,875,944
1,875,945
Allowing only one select option of a certain value to be selected
<p>I created a jsfiddle for this at <a href="http://jsfiddle.net/MZtML/" rel="nofollow">http://jsfiddle.net/MZtML/</a></p> <p>I have a row of images with a select box to determine what type of image it is. These are the options:</p> <pre><code>&lt;select name="image-type"&gt; &lt;option value="none"&gt;Select Image Type&lt;/option&gt; &lt;option value="small-thumbnail"&gt;Small Thumbnail (70x50)&lt;/option&gt; &lt;option value="thumbnail" selected="selected"&gt;Thumbnail (140x100)&lt;/option&gt; &lt;option value="feature"&gt;Feature&lt;/option&gt; &lt;option value="gallery"&gt;Gallery&lt;/option&gt; &lt;/select&gt; </code></pre> <p>Now when there are several rows of images, I only want to allow one row to be designated as Feature. If another row is currently set as Feature it should be reset to Select Image Type. The same with Small Thumbnail and Thumbnail.</p> <p>There can be multiple images set as Select Image Type and as Gallery.</p> <p>I've been trying using the follow jQuery:</p> <pre><code>$('#image_container').on('change', '[name="image-type"]', function() { $this = $(this); $('[name="image-type"]').not($this).each(function() { if ($(this).val() === 'feature') { $(this).val('none'); } }); }); </code></pre> <p>I've tried a few variations of this and I have gotten close, but nothing I've tried seems to do it accurately. Can someone help me out?</p>
javascript jquery
[3, 5]
4,229,314
4,229,315
jQuery making images bigger
<p>On my site I've got images which are in reality for example 2000 / 1500 px </p> <p>I resized them using width and height properties in CSS, but I would like to show them bigger (maybe in popup or something like that) after clicking on them.</p> <p>Which one plugin or method is the easiest one to accomplish this?</p>
javascript jquery
[3, 5]