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,339,446
2,339,447
calling c# method from tag inline
<p>how i get this work:</p> <pre><code>&lt;script type="text/javascript" runat="server" src='&lt;% getSrc("ddd") %&gt;' &gt;&lt;/script&gt; </code></pre> <p>getSrc is a method in code-behind file.</p> <p>tanks.</p>
c# asp.net
[0, 9]
4,428,915
4,428,916
Play sound only in one window of which is active (within one website) using javascript (possibly jquery)
<p>Alright, I've found a bunch of answers concerning native functions like window.onblur and window.onfocus... But they won't help so I'd like to be more specific</p> <ol> <li>Say you open several tabs of one website</li> <li>Say you receive a message and there's a sound to announce the message</li> <li>As you have several tabs opened, you will hear the sound the number of opened tabs. Which makes a how'd'u'callit symphony</li> </ol> <p>Best solutions I've found so far, but which don't work 1. window.onfocus and window.onblur 2. Play sound if <strong>var infocus</strong> evaluates to true, don't play if not 3. It is crossbrowser 4. It is simple 5. It does not work</p> <p>Why the best solution won't work? Say you switch focus to another tab of a different website, your website loses focus so you won't hear the sound. Even worse, say you switch to another program, then the browser itsel loses focus and you won't hear the sound</p> <p>So what shall I do?</p>
javascript jquery
[3, 5]
905,038
905,039
Php keeps giving me an incorrect response for android in-app-billing server verification
<p>For some reason I got this script to work without fault but once i tried to decode the JSON the script started messing up. I reverted back to the old script and it still isn't working. Here it is below. $result keeps giving me 0 which if the PHP documentation is correct means that the verification failed. I have double checked public_key.pem to see if it is correct and it is. I have also checked to see if signedData and signature are being sent and they are being sent. What could possibly be wrong with this script?</p> <pre><code>&lt;?php $signed_data = $_POST['signedData']; $signature = $_POST['signature']; $fp = fopen("./public_key.pem", "r"); $cert = fread($fp, 451); fclose($fp); $pubkeyid = openssl_get_publickey($cert); $signed_data = trim($signed_data); $signature = base64_decode($signature); $result = openssl_verify($signed_data, $signature, $pubkeyid, OPENSSL_ALGO_SHA1); if ($result == 1) { echo 'correct'; } else if ($result == 0) { echo 'fail'; echo '||'; echo $pubkeyid; echo '||'; echo $signed_data; } else { echo 'epic fail'; } openssl_free_key($pubkeyid); ?&gt; </code></pre>
php android
[2, 4]
5,268,960
5,268,961
Convert a String into Java Source code in Android
<p>Does anyone know if it's possible to convert a String/file into java source which can be compiled at run time using something like JavaCompiler. It looks like this is possible with Java 6, but I haven't seen anyone say that JavaCompiler is available in Android. </p> <p>Basically my main goal is to turn a String or file text into source code in Android. Does anyone know how that can be done?</p> <p>Thanks!</p>
java android
[1, 4]
5,343,189
5,343,190
Send email to IDN email ID
<p>How do I send email to non-Ascii email ID, for example I have adad@ÄÖß.com as emailID and when I try to send email to this emailID using </p> <pre><code>sendTo="adad@ÄÖß.com"; MailMessage msg = new MailMessage(); msg.To.Add(sendTo); </code></pre> <p>msg.To.Add(sendTo) throws an error saying "The specified string is not in the form required for an e-mail address.". </p> <p>Did you guys face this ever? Is this possible? if yes, Any idea of how I can get this working? </p>
c# asp.net
[0, 9]
3,391,534
3,391,535
reading bytes without using any loop
<p>I have a 16mb binary file and I want to read bytes without using any loop. like if i want to read 16 byte i can pass 16 to some method(if there is any) and it give me my desired result... right now i am using loop for reading bytes but my application is so huge i am afraid that it do not get slow.kindly give me some hint.</p> <p>thanks alot.</p>
java android
[1, 4]
762,278
762,279
How can I rewrite jQuery without guard clause?
<p>How can I rewrite this jQuery to be more terse and without the guard clause?</p> <pre><code>var myTextBox = $('#myTextBox'); if (myTextBox ) myTextBox.val(""); </code></pre> <p>The guard clause is there simply to ensure that the element exists on the page before trying to set it's value but the code seems bloated and most of it unnecessary. What's the preferred solution to this?</p>
javascript jquery
[3, 5]
5,308,294
5,308,295
How to hide view source
<p>Could some one please help me out to hide a view source option of a web page in dot net ?</p>
c# asp.net
[0, 9]
4,530,133
4,530,134
pass data and get data into php file from html to jquery to php and then from php to jquery to html
<p>OK i have this code</p> <p>HTML:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"&gt; &lt;/script&gt; &lt;script type="text/javascript"&gt; function get() { $.post('tt.php', { $('#name') }, function(output) { $('#age').html(output).show(); }); } &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input type="text" id="name" name="name"/&gt; &lt;a href="javascript:get()"&gt;haller&lt;/a&gt; &lt;div id="age"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>and then this php file.</p> <p>PHP:</p> <pre><code>&lt;? $name=$_POST['name']; if ($name=="juliver") { echo "haller"; } elseif ($name==NULL) { echo "Please put a name!"; } else { echo "wrong name"; } ?&gt; </code></pre> <p>the scenario is this, whatever value that the input has, it will be pass into the php file using the jquery of course as you can see, whenever the user clicks on the anchor tag which has the get() function and then the php file process the data (execute) and then pass it back to the jquery and then the jquery will output the data into the html. as of right now, i cant make this thing work. plesae help me. thanks in advance.</p>
php javascript jquery
[2, 3, 5]
4,678,193
4,678,194
Is it possible to set audio file after receiving call of out side
<p>I want to play audio file at the time the receiver receive call at receiver side.</p> <p>My application will call a caller and if caller receive a call, i want to listen audio file or recorded file to receive.</p> <p>If this is possible, then please give me some instruction for this.</p>
java javascript android
[1, 3, 4]
334,566
334,567
Load div contents into a different div
<p>I have a value which is created around the middle of a page and I want to show it in the header...</p> <p>So, I have the following:</p> <pre><code>&lt;div id=lines style=display:none;&gt;&lt;? echo ($line_no-1); ?&gt;&lt;/div&gt; </code></pre> <p>Now, I want to load that value ($line_no-1) into a div in the header. So as you can see I store it into a div, turn off the display, and then use the following to try to load it into the div above </p> <pre><code>&lt;script type="text/JavaScript"&gt; $(document).ready(function(){ $("#lines2").load("/ #lines"); }); &lt;/script&gt; </code></pre> <p>It simply doesn't work and I think I've tried every combination now</p> <p>What I'd rather do is simply load the variable into the div above but have searched and searched for a way to do this with no luck.</p>
javascript jquery
[3, 5]
4,188,126
4,188,127
Java or C# for a PL/SQL Developer
<p>Can you Please suggest as what should be my next carrer move , I am an Oracle Developer , I worked in Forms and reports and know good PL/SQL and SQL.</p> <p>Now , I am thinking to learn new technology as there no jobs in PL/SQL alone and Oracle front-end Forms and reports are on the verge of extinction.</p> <p>The issue is that I have with Java is its HUGE and I need to learn a lot many other technologies as well ( struts , hibernate , spring etc ) in addtion to adv java and Java EE coming. I am think as which technology can give with edge , with PL/SQL and Oracle ...</p> <p>Thank you.</p>
c# java
[0, 1]
434,488
434,489
Get check box value in jQuery?
<p>I need to get a check box value in jQuery. Here is my code:</p> <pre><code>$(document).ready(function() { $('input[type="checkbox"]').bind('click',function() { var tObj = $('#checkpermission'); var tVal = tObj.val(); alert(tVal); }); }); $query="select * from tbl_user where username!='admin' and password!='admin' order by username limit $eu, $limit"; $result=mysql_query($query); while($data=mysql_fetch_array($result)) { &lt;td&gt;&lt;INPUT TYPE="checkbox" name="checkuser" id="checkpermission" onclick="changePage()" value='&lt;?=$data[0]?&gt;'&gt;&lt;/td&gt; &lt;?php } </code></pre> <p>Every time I only get the first value. What am doing wrong?</p>
php javascript jquery
[2, 3, 5]
2,134,026
2,134,027
Add next/previous year button to asp calendar control
<p>Need to add a button for next previous year in ASP calendar control dynamically.</p> <p>How can I add it right next to the existing next and prev controls? Is it possible to do this via dayrender event ?? Please help</p>
c# asp.net
[0, 9]
424,853
424,854
Jquery - Show a javascript alert box when you click on a disabled text input
<p>I have a form where one of the text inputs is set to disabled. It's important that we keep this text input but it has confused some users. They try to click and edit and think that the form is broken because they can not edit that box.</p> <p>I've tried to add an onclick to trigger a window.alert box to warn them that they can't edit this text input. I haven't been able to get it to work.</p> <p>Does anyone know a way using jquery that if they click on a disabled text input that it shows a window.alert?</p> <p>Thanks for the help...</p>
javascript jquery
[3, 5]
3,356,866
3,356,867
How to create a custom function which i can turn it off on a click?
<p>I am running a bit of code once the page load so in the footer i have got:</p> <pre><code>$(function(){ //code to run on page load }); </code></pre> <p>But then i need to stop that code to run on a</p> <pre><code>.click() </code></pre> <p>I was thinking of having a custom function which runs on page load and then be able to disabale that function on a click.</p> <p>How to create a custom function which i can turn it off on a click?</p>
javascript jquery
[3, 5]
5,612,457
5,612,458
How to write code to put an extra load on "Disk Queue Length" keeping "Processor Time" scores low
<p>I would like to test the program which shows an alert when the average of "Disk Queue Length" exceeds 3.<br> But alert gets to be showed also when the average of "Processor Time" exceeds 75%. I would like to test only about "Disk Queue Length".<br> Could you tell me how to write the stress-test code by C#?</p>
c# asp.net
[0, 9]
2,172,740
2,172,741
How can I access the state of "clicked" in this piece of jQuery
<p>I have this piece of jQuery. Is it possible to determine whether the <code>#mydiv</code> element has been "clicked" from outside this piece of code.</p> <p><a href="http://jsfiddle.net/byronyasgur/BxF9R/" rel="nofollow">JSFIDDLE</a></p> <pre><code>$.fn.clicktoggle = function(a, b) { return this.each(function() { var clicked = false; $(this).bind("click", function() { if (clicked) { clicked = false; return b.apply(this, arguments); } clicked = true; return a.apply(this, arguments); }); }); }; function odd() { alert("odd"); } function even() { alert("even"); } $("#mydiv").clicktoggle(even, odd); </code></pre>
javascript jquery
[3, 5]
3,991,024
3,991,025
ScrollView Height does not wrap onto parent activity in code
<p>I have this little problem regarding layout with scroll view on my android code</p> <pre><code>import android.os.Bundle; import android.app.Activity; import android.app.AlertDialog; import android.content.DialogInterface; import android.graphics.Color; import android.view.Menu; import android.view.ViewGroup.LayoutParams; import android.widget.ArrayAdapter; import android.widget.ListView; import android.widget.ScrollView; public class ScheduleList extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); getWindow().getDecorView().setBackgroundColor(Color.BLACK); setTheme(R.style.DefaultForm); ScrollView sv = new ScrollView(this); ListView lv = new ListView(this); String data[] = { "Android", "iPhone", "BlackBerry", "AndroidPeople" }; ArrayAdapter adapter = new ArrayAdapter&lt;String&gt;(this,android.R.layout.simple_list_item_1, data); lv.setAdapter(adapter); sv.addView(lv); sv.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); setContentView(sv); } } </code></pre> <p>And this is what I get <a href="http://i.stack.imgur.com/spLx0.jpg" rel="nofollow">Result Image</a></p> <p>How do I resize this ScrollView to match height into my activity form, I did change the LayoutParams.FILL_PARENT and also LayoutParams.WRAP_CONTENT on setLayoutParams but it doesn't work.</p>
java android
[1, 4]
1,978,745
1,978,746
How do i timeout a jquery script thats set to run every second after half an hour?
<p>I have a jQuery script that runs a function every second with setinterval. But i want to set a timeout for that so after half an hour it kills the script. How do i do this? Thanks :)</p> <p>source code:</p> <pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/ libs/jquery/1.3.0/jquery.min.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(function() { setInterval(oneSecondFunction, 1000); }); function oneSecondFunction() { //var ID = $(this).attr("id"); var ID = '1'; if(ID){ $("#more"+ID).html('&lt;img src="moreajax.gif" /&gt;'); $.ajax({ type: "POST", url: "ajax_more.php", data: "lastmsg="+ ID, cache: false, success: function(html){ $("ol#updates").prepend(html); $("#more"+ID).remove(); } }) } return false; } &lt;/script&gt; &lt;style&gt; </code></pre>
javascript jquery
[3, 5]
5,923,585
5,923,586
accessing methods of page when accessing page with a page method
<p>I have a code behind file of an aspx file that looks like this:</p> <pre><code>public partial class Pages_MyPage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { ..... } protected int MyMethod() { ..... } [WebMethod] public static int MyPageMethod() { int x = MyMethod(); return x; } } </code></pre> <p>When I'm sending an ajax POST to MyPageMethod, I can't access MyMethod. What's the way around this issue.</p> <p>Thanks for your suggestions.</p>
c# asp.net
[0, 9]
635,592
635,593
how to get the right class name innerHTML content?
<pre><code>&lt;div class="Name"&gt; &lt;div class="Image"&gt;&lt;/div&gt; &lt;ul&gt; &lt;li&gt;&lt;h5&gt;&lt;span class"myName"&gt;I want this text&lt;/span&gt;&lt;/h5&gt;&lt;/li&gt; &lt;li class="description"&gt;The description&lt;/li&gt; &lt;/ul&gt; &lt;button class="myButton"&gt;My Button&lt;/button &lt;/div&gt; </code></pre> <p>(multiple items with the same structure)</p> <p>if my structure is constructed this way, how can I get the class myName to have its content as a variable?</p> <pre><code>$(".myButton").click(function () { var itemName = $(this).siblings(".myName").innerHTML ?? } </code></pre>
javascript jquery
[3, 5]
3,441,046
3,441,047
jquery loading images dynamically
<p>I have an img element and each time I change its src dynamically I want to get new image's width (after it's completely loaded)</p> <p>.load() seems not trigger if image is in cache already(?), but I don't want to load it again in this case, as:</p> <pre><code> 'image.jpg?' + new Date().getTime(); </code></pre> <p>would(?)</p> <p>What is the best way to do it?</p> <p>Edit:</p> <pre><code>$('#test img:first').load(function() { console.log($(this).width()); }); </code></pre> <p>seems it doesn't trigger if images in cache already</p>
javascript jquery
[3, 5]
1,005,912
1,005,913
How to highlight div using javascript or jquery
<p>I spent about hour and did not find any clue how to highlight my div.</p> <p>Ok example my code.</p> <p>1.proccess.php</p> <pre><code>$_SESSION['msg']='&lt;div class="success"&gt;Your account has been updated&lt;/div&gt;'; header("location:http://domain.com/account.php/"); </code></pre> <p>2.account.php</p> <pre><code>if ($_SESSION['msg']!="") { echo $_SESSION['msg']; unset($_SESSION['msg']); } </code></pre> <p>Now I want the javascript or jquery to highlight the <code>&lt;div class="success"&gt;</code> on account.php. How to do that? Let me know :)</p>
php javascript jquery
[2, 3, 5]
5,363,425
5,363,426
Retreiving DateTime x-axis value from Chart control
<p>I have a chart control with a data in it. The x-axis data is of DateTime and the Y-axis is an integer. I'm trying to pull the data out of the graph and export it to excel, but the DateTime values aren't coming out in a way I can understand them or figure out how to decode them.</p> <p>Example values are as such:</p> <p>The graph begins at 4/30/2012 and goes to 8/13/2012.</p> <p>The values show: </p> <pre><code>{X=41030, Y=16991} {X=41031, Y=34363} {X=41032, Y=26744} {X=41033, Y=28180} {X=41034, Y=17478} ...intermediate values {X=41134, Y=1785} </code></pre> <p>I set the chart x-axis type to date time with </p> <pre><code>RestartBooksAttempts.Series["Attempts"].XValueType = ChartValueType.DateTime; RestartBooksAttempts.Series["Books"].XValueType = ChartValueType.DateTime; </code></pre> <p>and I'm grabbing the values with:</p> <pre><code>Convert.ToDateTime(chart.Series[s.Name].Points[i].XValue) double y = chart.Series[s.Name].Points[i].YValues[0]; </code></pre> <p>obviously the x-points are not a DateTime convertable value, does anyone have any idea how to decode these values?</p>
c# asp.net
[0, 9]
4,887,922
4,887,923
finding all the HtmlInputCheckBox controls with master.pages with recursion
<p>I thought this would work. But it's not working. It's never getting inside of if (c is HtmlInputCheckBox)</p> <pre><code>private string GetAllCheckBoxes(ControlCollection controls) { StringBuilder sb = new StringBuilder(); foreach (Control c in controls) { if (c.HasControls()) { GetAllCheckBoxes(c.Controls); } else { if (c is HtmlInputCheckBox) { CheckBox cb = c as CheckBox; if (cb.Checked) { sb.Append(cb.ID + "_1"); } else { sb.Append(cb.ID + "_0"); } } } } return sb.ToString(); } </code></pre> <p>update: c is throwing somesort of error. </p> <pre><code>Parent = {InnerText = '((System.Web.UI.HtmlControls.HtmlContainerControl)(((System.Web.UI.HtmlControls.HtmlGenericControl)(c.Parent)))).InnerText' threw an exception of type 'System.Web.HttpException'} </code></pre>
c# asp.net
[0, 9]
1,196,413
1,196,414
paste option for edittext
<p>I have an edittext and I would like to paste some text in it. I can copy the text from some web page but I am not able to paste the text in my edittext control.How can I enable my edittext to paste some text.Here is my main.xml for edittext ;</p> <pre><code>enter code here &lt;EditText android:id="@+id/enter" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight= "2" android:scrollbars="vertical" android:textColor="@color/black" /&gt; </code></pre> <p>Thanks</p>
java android
[1, 4]
2,484,873
2,484,874
issue with expandable listview setOnChildClickListener
<p>I am developing application with expandable listview and get display data in this listview very well,but problem is with <code>setOnChildClickListener</code> which is not working. there are no interactive widget(checkbox or edittex)which cause the issue of focus and we need to false the focus ,no there are not I have taken Texview only in Parent list as well as in child. I have also tried with do that all texview <code>focusable as false</code> but not getting success.can you please solve this</p> <p>code :</p> <pre><code>mlvInstructionlist = (ExpandableListView)amviInstruction. findViewById(R.id.lvInsListofInstruction); AssetsWiseInstructionListAdapter adapter = new AssetsWiseInstructionListAdapter(getActivity(),mlvInstructionlist, mlstGroupCollection); mlvInstructionlist.setAdapter(adapter); mlvInstructionlist.setOnChildClickListener(this); @Override public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) { // TODO Auto-generated method stub Toast.makeText(getSherlockActivity(), "Child click Header",Toast.LENGTH_LONG).show(); AppLog.showLogI(TAG, "Child click Header"); return true; } </code></pre>
java android
[1, 4]
1,289,200
1,289,201
How to use jQuery slideDown() to display _almost_ all contents?
<p>I have a div within a div. On page load, they should both be hidden, then when I trigger the <code>slideDown()</code> function on the outer div, I want the inner div to remain hidden. How can I achieve this?</p> <pre><code>&lt;script&gt; $(function(){ $('.body').hide(); $('.display').click(function(){ $(this).closest('.wrapper').find('.body').slideDown(); }); }); &lt;/script&gt; &lt;div class="wrapper"&gt; &lt;a class="display" href="#"&gt;Display Outer&lt;/a&gt; &lt;div class="body"&gt; Now displaying outer div &lt;div class="wrapper"&gt; &lt;a class="display" href="#"&gt;Display Inner&lt;/a&gt; &lt;div class="body"&gt; Now displaying inner div &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Here is an example of it not working: <a href="http://jsfiddle.net/b7Tpt/" rel="nofollow">http://jsfiddle.net/b7Tpt/</a></p>
javascript jquery
[3, 5]
149,740
149,741
JQuery - passing variable to php script
<p>im stucked with following issue. I have an javascript (jquery) function where i need to pass a variable to php ON .success method. See below Please:</p> <p><a href="http://paste.org/55404" rel="nofollow">http://paste.org/55404</a></p> <p>Any idea how to achieve this? Or is it even possible?</p> <p>Thanks in advance.</p>
php jquery
[2, 5]
2,348,427
2,348,428
where the memory allocated when we declare static?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/3849634/static-allocation-in-java-heap-stack-and-permanent-generation">static allocation in java - heap, stack and permanent generation</a> </p> </blockquote> <p>its a small confusion...defining static to class, methods and variables.In this three cases where thus the memory allocated. ? My boss is familiar with C,he says only variables are in heap memory and rest (static classes and static methods) will remain in main memory. is that ture? any explanation.?</p> <p>one more in android using static class and static methods is a best practice ?</p>
java android
[1, 4]
5,469,428
5,469,429
How to match external links with javascript (but ignore subdomains)?
<p>I have the following (jquery) selector looking for external links.</p> <p>This works, and ignores all links that include <code>location.hostname</code> <em>(e.g. www.domain.com)</em></p> <p>My question is, how to extend this to also ignore links to subdomains of your site? <em>(e.g. new.domain.com)</em></p> <pre><code>$('a').each(function() { var href = $(this).attr('href'); if(this.hostname &amp;&amp; this.hostname !== location.hostname) { $(this) .removeAttr('target') .attr('rel', 'external') .attr('title', href) .click(function() { window.open($(this).attr('href')); return false; }); } }); </code></pre>
javascript jquery
[3, 5]
151,170
151,171
when a web app generate most markup by javascript ...
<p>I have seen a web app that generate most of a page's markup by javascript+ jquery. The server only generate a web page with just 1 DIV . The rest are done with create on client side via javascript+jquery+AJAX .</p> <p>What are the pros and cons of this javascript centric approach ?</p>
javascript jquery asp.net
[3, 5, 9]
2,464,118
2,464,119
JavaScript / jQuery why doesn't this work?
<pre><code>function checkSession(){ $.ajax({url: "session.php", success: function(data){ if( data == 1){ var postFilen = 'msg.php'; $.post(postFilen, function(data){ $("#msg").html(data).find("#message2").fadeIn("slow") } } else { $('#message2').hide(); } }}); // setInterval('checkSession()',1000); } </code></pre> <p>Basically, this is checking if data is 1 in session.php, and if it is, it should run msg.php´s div #message2 in #msg</p>
javascript jquery
[3, 5]
1,855,004
1,855,005
Regular expression for validating phone
<p>I need to validate textbox for validating phone number in C# allowing only hyphens(-) and integer values.</p> <p>I want a regular expression which allows only those.</p> <p>Thanks in advance</p>
c# javascript
[0, 3]
988,465
988,466
jQuery fn() isn't loading / working?
<p>There is one div which changes frequently it's innerHTML by ajax. Once the page loads, jQuery function() works but when innerHTML changes by ajax then some functionality doesn't work. I checked the code using firebug and try to explain it in short.** </p> <p>I think DOM loads the js file only when the page loaded first time and if ajax modifies innerHTML then function is not invoked somehow.What you say? what could be solution according to you? <strong><em>HTML page</em></strong></p> <pre><code> &lt;body&gt; &lt;div class="_div_change"&gt; dynamically class add by jQuery function() here contenet is added by ajax functionality &lt;/div&gt; &lt;script type="text/javascript"&gt; $(function(){ $('._div_change').addClass('.div_class'); }); &lt;/script&gt; &lt;/body&gt; Loading first time &amp; class is added by fn() |only div innerHTML modified by ajax *** | &lt;div class="_div_change div_class"&gt; | &lt;div class="_div_change"&gt; innerHTML elements added successfully| innerHTML elements altered successfully &lt;/div&gt; | &lt;/div&gt; </code></pre>
javascript jquery
[3, 5]
5,726,489
5,726,490
categorization of location to
<p>how to categorized location such as office, school etc from address, For example. my address is "gigaspace IT park,vimannagar,pune" How to infer "office" from address. Is there any model or any text or algorithm available or calculation from the address i need to do that.</p>
java android
[1, 4]
1,062,066
1,062,067
jquery dropdown focus
<p>I am trying to set a focus on a dropdown within GridView(gridViewDropDown class) when page loads:</p> <pre><code>if ($('select.gridViewDropDown').length) { alert("Found my dropdown"); //$('select.gridViewDropDown:first').focus(); setTimeout(function() { $('select.gridViewDropDown').focus(); }, 10); } </code></pre> <p>I can see the alert which means that dropdown is found but it never gets a focus. What do I need to change here? I am using IE 6/7.</p>
asp.net jquery
[9, 5]
5,914,750
5,914,751
How to Implement Google direction in asp.net
<p>google map direction in asp.net. How can we achive</p> <p>How to Implement Google direction in asp.net</p>
c# asp.net
[0, 9]
5,118,171
5,118,172
JavaScript In UserControl Wont Run
<p>I am trying to run the following script from my usercontrol:</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; function RebindUpdatePanelControls(sender, args) { $("#divUpload2").hide(); $("#divUpload3").hide(); alert("Hi Neck"); $('#lnkMore').click(function () { if ($('#hfClicked').val() == "0") { $("#divUpload2").slideToggle(); $('#hfClicked').val("1"); } else if ($('#hfClicked').val() == "1") { $("#divUpload3").slideToggle(); $('#hfClicked').val("2"); } }); } &lt;/script&gt; &lt;script type="text/javascript"&gt; Sys.Application.add_load(RebindUpdatePanelControls); &lt;/script&gt; </code></pre> <p>I added it to the top of the usercontrol file but it will not run </p> <p>lnkMore looks like this:</p> <pre><code> &lt;input id="lnkMore" type="button" value="Add GCM File" /&gt; </code></pre> <p>Is there something else I am missing to do to get this running?</p> <p>How do I make the client side button use this code when it isclicked?</p>
javascript asp.net
[3, 9]
4,756,715
4,756,716
Android - Opening phone deletes app state
<p>I'm writing an android application that maintains a lot of "state" data...some of it I can save in the form of onSaveInstanceState but some of it is just to complex to save in memory.</p> <p>My problem is that sliding the phone open destroys/recreates the app, and I lose all my application state in the process. The same thing happens with the "back" button, but I overloaded that function on my way. Is there any way to overload the phone opening to prevent it from happening?</p> <p>Thanks in advance.</p>
java android
[1, 4]
5,369,341
5,369,342
Set programmaticaly the Text property calling a function from code behind
<p>I'd like to initialise the label of the button from function from code behind:</p> <pre><code>&lt;asp:Button ID="BtnAjoutClient" runat="server" Text='&lt;%= GetText()%&gt;' /&gt; </code></pre> <p>and in the code behing a simple function like:</p> <pre><code>protected String GetText() { return "test"; } </code></pre> <p>But the caption of the button shows me the raw code (and the function is never called). I tryied also <code>&lt;%# GetText() %&gt;</code>. Do you know why ?</p> <p>Regards</p>
c# asp.net
[0, 9]
3,314,365
3,314,366
jQuery Calculate Date
<p>Any reason why this is landing on the wrong day?</p> <p><a href="http://jsfiddle.net/SparrwHawk/MH5wP/" rel="nofollow">http://jsfiddle.net/SparrwHawk/MH5wP/</a></p> <p>I've written the code below for reference, but it's obviously clearer on jsfiddle</p> <pre><code>&lt;p&gt;Sun / Closed&lt;/p&gt; &lt;p&gt;Mon / Closed&lt;/p&gt; &lt;p&gt;Tues / 9am – 5pm&lt;/p&gt; &lt;p&gt;Wed / 9am – 5pm&lt;/p&gt; &lt;p&gt;Thurs / 9am – 8pm&lt;/p&gt; &lt;p&gt;Fri / 9.30pm – 6.30pm&lt;/p&gt; &lt;p&gt;Sat / 8.30am – 4.30pm&lt;/p&gt; &lt;script&gt; // Day where 0 is Sunday var date = new Date(); var d = (date.getDay()); $(function(){ if (d = 1) { $('p:contains("Mon")').addClass('today'); } else if (d = 2) { $('p:contains("Tues")').addClass('today'); } else if (d = 3) { $('p:contains("Wed")').addClass('today'); } else if (d = 4) { $('p:contains("Thurs")').addClass('today'); } else if (d = 5) { $('p:contains("Fri")').addClass('today'); } else if (d = 6) { $('p:contains("Sat")').addClass('today'); } else { $('p:contains("Sun")').addClass('today'); } }); &lt;/script&gt; </code></pre>
javascript jquery
[3, 5]
5,108,772
5,108,773
Can we use javascript in C#?
<p>I want to use Javascript functionality in c#. Is it possible to use Javascript in c#? If yes how?</p> <p>Can anyone provide me some guide or sample code?</p> <p>Thanx</p>
c# javascript
[0, 3]
5,555,404
5,555,405
If statement, $(this) == $("#div")
<p>Hya,</p> <p>I would like to run a bit of code only if the focused text-box has a certain ID. Here is my code:</p> <pre><code>$("input:text").focus(function() { if ($(this) == $("#divid")) { //action } }); </code></pre> <p>It does not work, I'm not to sure why.</p>
javascript jquery
[3, 5]
43,309
43,310
How to use jQuery.validity properly
<p>Yesterday, I started here asking a question about my own project, and when I saw how helpful the people are and how fast they answered, I was really happy. My father is making a project by himself, and he asked me to write a question here for him because of English knowledge matters.</p> <p>Well, he is trying to validate a form using jQuery.validity ( <a href="http://validity.thatscaptaintoyou.com" rel="nofollow">http://validity.thatscaptaintoyou.com</a> ), but his function of validation is not working. Here is his code: <a href="http://pastebin.com/uvXRTZsE" rel="nofollow">http://pastebin.com/uvXRTZsE</a></p> <p>I'm sorry for not pasting it here, but after several tries, parts of the code were missing when pasting them here.</p>
php javascript jquery
[2, 3, 5]
5,321,953
5,321,954
Close popup (div) jquery
<p>I have a div which appears when a textbox gets focus. DIV has <em>n</em> number of textboxes. I want to say display:none when a user Clicks anywhere in the window. Div should not close if the user is switching between textboxes. </p> <p>All these jquery plugins, say the calendar control closes if user clicks outside. How is that happening? Any idea?</p>
c# jquery
[0, 5]
4,420,961
4,420,962
how to assign the html value to the php variable without post or get method
<p>in my program i had a php value $test = 2 using this value i done some operation for example: in my page i had a 2 block A and B and one select box. If the test value is A it enable the div A, if the value is B it hide div A and also i am able to show and hide the div using the select box onchange event. please check my sample code given below</p> <pre><code>$test = $_GET["id"]; &lt;select name="hideme" id="hideme" onchange="enableme();"&gt; &lt;option value="A"&gt;Show&lt;/option&gt; &lt;option value="B"&gt;Hide&lt;/option&gt; &lt;/select&gt; if($test == 'A') { &lt;div id="div1" name="div1"&gt; xxxxxxxxxxxxx &lt;/div&gt; } </code></pre> <p>Js Function :</p> <pre><code>function enableme() { if(document.getElementByID('hideme').value == "A") { document.getElementById.style.display ="block"; } else { document.getElementById.style.display ="none"; } } </code></pre> <p>my issue is at fist time using the $test($_get) value it show the correct div but the on change event is not working because of , if condition. If i remove the if condition then it show div A even if the value of the $test is B. how could i handle both. Please Help me</p>
php javascript
[2, 3]
3,296,393
3,296,394
How to Edit Hyper Link GridView record in UserControl and Bind Data
<p>In Web Application, How to edit the record of Hyperlink Gridview in Usercontrol.</p> <p>I have one .aspx page which contains textboxes for new record and Hyperlink Gridview for editing.If I click hyperlink field, it redirects to the another .aspx page which has included usercontrol.</p> <p>Usercontrol has three textboxes for getting the details of record which has to edit, and one button for binding the data into database.</p> <p>I'm newbie of webapplication, Please help me as soon as. Today I have to submit my task.</p> <p>Thanks in advance. Sathya</p>
c# asp.net
[0, 9]
3,009,923
3,009,924
Android ProgressDialog delayed before showing up
<p>I'm using the ProgressDialog in android to prevent the user from, say, pressing a button multiple times while a long task is updating the UI. </p> <p>My problem is that the ProgressDialog does not seem to show up after awhile, as it seems to be another thread. </p> <p>In my experiment I called this ProgressDialog show() in an EditText's text changed listener. It still allows me to type in multiple characters in a short period before showing up.</p> <p>Is there a way I can detect that the ProgressDialog has already started?</p> <p>Edit 1: This was done on a real device. The code is simply this:</p> <pre><code> editText.addTextChangedListener( new TextWatcher() { ... public void onTextChanged(CharSequence s, int start, int before, int count) { ProgressDialog lock = new ProgressDialog(UIClass.this); lock.show(); } ... }); </code></pre> <p>My first assumption was that this would show the dialog immediately after the first character I type, but when I tested by typing multiple characters in a short period it was still possible, and the locking only starts after the 2nd or 3rd character. I am assuming that this is because the ProgressDialog is another thread. I wish to know how to make it properly lock the UI at the exact point I am interested in.</p>
java android
[1, 4]
864,051
864,052
Accessing raw partition in Android using Java
<p>I have a partition in Android that's not mounted because it doesn't have a file system, and I need to write a string into it. I tried three different methods, and only the first (from adb) works. I need to do this under program control, which is what the second and third methods do, but both fail. I tried adding system permissions to my app, but that didn't help. Do I need root permission to do this from a program?</p> <p><strong>First Method -</strong></p> <pre><code>adb shell "echo test &gt; /cache/command" adb shell dd if=/cache/command of=/dev/block/mmcblk3p3 bs=4096 seek=1 </code></pre> <p><strong>Second Method -</strong></p> <pre><code>java.lang.Process p = Runtime.getRuntime().exec( "dd if=/cache/command of=/dev/block/mmcblk3p3 bs=4096 seek=1"); </code></pre> <p><strong>Third Method -</strong> </p> <pre><code>File fileName = new File("/dev/block/mmcblk3p3"); String cmd = "test"; FileOutputStream fos = new FileOutputStream(fileName); fos.write(cmd.getBytes(), 4096, cmd.length()); fos.flush(); </code></pre> <p>The second method gives no feedback, even though it failed to work. The third method gives the following output:</p> <pre><code>W/System.err( 1014): java.io.FileNotFoundException: /dev/block/mmcblk3p3 (Permission denied) </code></pre>
java android
[1, 4]
3,481,229
3,481,230
ical event item is saved on windows outlook but not on Mac outlook?
<p>I have a situation where users can save an event item from my site to their outlook.</p> <p>So everything works fine on Windows outlook, but not on Mac outlook. When I test it on Mac it ask me to save it, but when i click on okay it is not saving the item on the calendar. Please let me know how to differentiate the Mac OS when you create the ical data.What are the attributes different on Mac from windows.</p> <p>Thanks</p>
c# asp.net
[0, 9]
1,067,456
1,067,457
give code to validate textbox if the textbox not contains the value except "mm-dd-yyyy" fromate it shoud display error message
<p>give code to validate textbox if the textbox not contains the value except "mm-dd-yyyy" fromate it shoud display error message.</p>
c# asp.net javascript
[0, 9, 3]
5,096,078
5,096,079
Correction of the mouseout and mouse over in relation to table
<p>Goal:<br> The row should have a different background color if the mouse's icon is inside of table's rows. When the icone is outside of the row, the background of the row should be turned back into default.</p> <p>Problem:<br> I can't make the sourcode in jQuery to be working properly.</p> <p>I would like to use jQuery only.</p> <p><a href="http://jsfiddle.net/uCFQ4/6/" rel="nofollow">Fiddle</a></p> <hr> <pre><code> &lt;TABLE id="dataTable" width="350px" border="1"&gt; &lt;TR class="row_overr"&gt; &lt;TD&gt;4&lt;/TD&gt; &lt;TD&gt;1&lt;/TD&gt; &lt;TD&gt;22&lt;/TD&gt; &lt;TD&gt;&lt;/TD&gt; &lt;/TR&gt; &lt;TR class="row_overr"&gt; &lt;TD&gt;4&lt;/TD&gt; &lt;TD&gt;1&lt;/TD&gt; &lt;TD&gt;22&lt;/TD&gt; &lt;TD&gt;&lt;/TD&gt; &lt;/TR&gt; &lt;TR&gt; &lt;TD&gt;4&lt;/TD&gt; &lt;TD&gt;1&lt;/TD&gt; &lt;TD&gt;22&lt;/TD&gt; &lt;TD&gt;&lt;/TD&gt; &lt;/TR&gt; &lt;/TABLE&gt; $(document).ready(function(){ /* $('tr').live('mouseover', function() { $(this).addClass('row_over'); }); $('tr').live('mouseout', function() { $(this).addClass('row_overr'); }); */ $('tr').mouseover(function() { $(this).addClass('row_over'); }); $('tr').mouseout(function() { $(this).addClass('row_overr'); }); }); .row_over { background: #AA1133; } .row_overr { background: #FFFFFF; } </code></pre>
javascript jquery
[3, 5]
2,116,534
2,116,535
can anyone give a complete example of how to call a js using java file?
<p>My code is like</p> <h3>SJCL.js</h3> <pre><code>function encrypt(data, key){ ...... } </code></pre> <h3>abcd.java</h3> <pre><code>public String callJavascript(String data,String key) { // i want to call the encrypt method here with data,key value passing to it } </code></pre> <p>any help????</p> <p>using <strong><em>java5</em></strong> only</p>
java javascript
[1, 3]
4,669,002
4,669,003
how to know if UI is idle for X time?
<p>I have a servery app. That ask questions from users. What I want to do. If user did not do any thing with UI for the 1 mint... Then I must terminate the server.</p> <p>What should I do for this?</p> <p>I know ACTION_SCREEN_OFF. This event actually called when screen time out. That may be 30 mint? depend on user setting. But let suppose user set time out for 30mint. and this event will call after 30 mint. But I want to know if UI is idle for 1 mint only.</p>
java android
[1, 4]
3,599,736
3,599,737
how to fix notice and check file on server side?
<p>I have an application <a href="http://helios.hud.ac.uk/u0867587/Files/Files.php" rel="nofollow">here</a></p> <p>I have 2 questions:</p> <p>Question 1: How do I fix the notice?</p> <p>Below is the code:</p> <pre><code>&lt;?php If(isset($_POST)) { $allowedImageTypes = array("image/pjpeg","image/jpeg","image/jpg","image/png","image/x-png","image/gif"); $file = $_FILES['imageFile']; // this is the line the notice is pointing to $fileType = $file['type']; if (!in_array($fileType, $allowedImageTypes)) { echo "Unsupported file type"; } else { // Process the file } } ?&gt; </code></pre> <p>Question 2: If you open the application, click on the "Add Question" button. This will add a table row. Now in the file input select a file which is invalid (like a .txt file for example).Now click on the "submit Details" button, it will state in an alert an "Unsupported file type" for question 1. Now go back to file input and change file to a valid format (.png, .jpg, .jpeg or .gif) and then after you have done that click on the "submit Details" button again, this time a confirmation box appears stating a message and if you want to proceed.</p> <p>Now this all works fine on client side but what I want is that when the user clicks on the "Submit Details" button, I want it to check if the file format is correct in server side as well as client side for security purposes. If it is valid then don't show message and if invalid then show message on top "Unsupported File Type". If a file input is blank then it is valid but if one file input contains the wrong file format, then display the invalid message. Does anyone know how to do this? Is the php code nearly there from achieving this?</p> <p>You can view full code in view source if you wish</p>
php jquery
[2, 5]
3,700,383
3,700,384
Removing duplicate strings using javascript
<p>I have an array of 800 sentences. I want to remove all duplicates (sentences that have the same exact words, but in different order) from the array. So for example "this is a sentence" and "is this a sentence" are duplicates. Only one one of them should remain in the array (it doesn't matter which one). </p> <p>My first idea was to copy them one by one to a new array, each time checking to see if the sentence already exists in the new array. I would accomplish this by looping through all the elements in the new array and using the following code for comparing the sentences: </p> <p><a href="http://stackoverflow.com/questions/1773069/using-jquery-to-compare-two-arrays">Using jQuery to compare two arrays</a></p> <p>However, this quickly becomes too intensive in terms of calculations and causes the javascript engine to be nonresponsive. </p> <p>Any ideas on how to make the algorithm more efficient would be appreciated. </p>
javascript jquery
[3, 5]
175,934
175,935
advertisement issue in slideshowextender
<p>i have use 5 usercontrols for advertisements.in that usercontrols i had use slideshow extender.when i click on any image within any user control that image url should be open in new tab.the url is like image desription which can be access from the database But the problm is that when i click on image from any user control,only last user control's image url which can be currently seen is getting opened.. Why this is happining?????</p> <pre><code>&lt;cc1:SlideShowExtender ID="SlideShowExtender1" runat="server" TargetControlID="ImageButton1" AutoPlay="true" Loop="true" SlideShowServicePath="~/SlideShow.asmx" SlideShowServiceMethod="FillRightImage" ImageDescriptionLabelID="lblImgId" &gt; &lt;/cc1:SlideShowExtender&gt; &lt;script language="javascript" type="text/javascript"&gt; function getSelectedImageId() { var _selectedImgID = window.document.getElementById("&lt;%=lblImgId.ClientID%&gt;"); var _txtImgID = window.document.getElementById("&lt;%=txt_imgID.ClientID%&gt;"); _txtImgID.value = _selectedImgID.innerHTML; window.open(_txtImgID.value,"blank"); } &lt;/script&gt; </code></pre>
c# asp.net
[0, 9]
4,939,870
4,939,871
HtmlControl changing class
<pre><code>&lt;div ID="btnWebL" runat="server" class="left_selected"&gt;&lt;/div&gt; &lt;asp:LinkButton ID="btnWeb" runat="server" CssClass="center_selected" OnClick="btnWeb_Click" Text="&lt;%$ Resources:ViaMura.Web.Default, WebSearchButtonText %&gt;"&gt;&lt;/asp:LinkButton&gt; &lt;div ID="btnWebR" runat="server" class="right_selected"&gt;&lt;/div&gt; </code></pre> <p>i want to change btnWeb class to left_not_selected. </p> <p>I try with:</p> <pre><code>HtmlControl btnWebL = FindControl("btnWebL") as HtmlControl; </code></pre> <p>but btnWebL does not have property for changing class. How can i change class?</p>
c# asp.net
[0, 9]
2,918,722
2,918,723
Android Notification Preferences
<p>I am trying to connect my check box preferences with my notification such that when the user clicks on any of the check box preferences, the Notification works as specified. I want the "entering" to work only if the preference "alarm entering" is clicked on. Same for exiting and vibration.</p> <pre><code> public void onReceive(Context context, Intent intent) { // TODO Auto-generated method stub String key = LocationManager.KEY_PROXIMITY_ENTERING; Boolean entering = intent.getBooleanExtra(key, false); if (entering){ Log.d(getClass().getSimpleName(), "entering"); } else{ Log.d(getClass().getSimpleName(), "exiting"); } SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); String alertName = prefs.getString("name_preference", ""); String alertMessage = prefs.getString("message_preference", ""); //boolean enteringRegion = prefs.getBoolean("alarm_entering", true); //boolean exitRegion = prefs.getBoolean("alarm_exiting", false); //boolean vibrate = prefs.getBoolean("vibrate_preference", true); NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); PendingIntent pendingIntent = PendingIntent.getActivity(context, 0, null, 0); Notification notification = createNotification(); notification.setLatestEventInfo(context, alertName, alertMessage, pendingIntent); notificationManager.notify(NOTIFICATION_ID, notification); } private Notification createNotification(){ Notification notification = new Notification(); notification.icon = R.drawable.icon_notification; notification.when = System.currentTimeMillis(); notification.flags |= Notification.FLAG_AUTO_CANCEL; notification.flags |= Notification.FLAG_SHOW_LIGHTS; notification.defaults |= Notification.DEFAULT_LIGHTS; long[] vibrate = new long[] {2000, 2000, 2000, 2000, 2000}; notification.vibrate = vibrate; Uri ringURI = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_ALARM); notification.sound = ringURI; notification.ledARGB = Color.BLUE; notification.ledOnMS = 1500; notification.ledOffMS = 1500; notification.flags = notification.flags | Notification.FLAG_SHOW_LIGHTS; return notification; </code></pre>
java android
[1, 4]
5,625,131
5,625,132
CKeditor and RSV validator issue
<p>I'm using ckeditor in content management system but can't validate ckeditor textarea. Used following code</p> <pre><code>$("#submit_btn").click(function () { CKEDITOR.instances.content.updateElement(); }); </code></pre> <p>Now the problems with RSV validator gone but now ckeditor gives bunch of errors</p> <pre><code>[12:12:41.635] ag.getOuterHtml is not a function @ http://localhost:81/core/includes/ckeditor/ckeditor.js:99 [12:12:41.694] af.getTarget().is is not a function @ http://localhost:81/core/includes/ckeditor/ckeditor.js:99 -- [12:13:40.869] Use of attributes' specified attribute is deprecated. It always returns true. @ http://localhost:81/admin/?page=add </code></pre> <p>How to fix that?</p>
javascript jquery
[3, 5]
5,878,830
5,878,831
Getting A Specific Twitter Status
<p>I've been trying to get the contents of a specific status using the status url e.g <a href="http://twitter.com/#!/jquery/status/36102693709680640" rel="nofollow">http://twitter.com/#!/jquery/status/36102693709680640</a> and also get the username associated with the status. In this case, @jquery</p> <p>Is there a way to do this in php and/or jquery?</p>
php jquery
[2, 5]
724,363
724,364
Dynamically adding attributes to <head> tag ASP.NET
<p>How would I go about finding on my ASPX page (from codebehind) and then adding the attribute "runat=server" to it? I have tried using <code>Page.header.attributes.add(...)</code> and<code>(HtmlHead) Page.FindControl("head");</code> The second one obviously won't work as the Head tag doesnt have an ID.</p> <p>I can't work out how to change this property and I can't change or add any additional code to the ASPX page - like ID's etc.</p>
c# asp.net
[0, 9]
3,017,864
3,017,865
Autorefresh some list of items every X seconds
<p>I have a list of items that I want to refresh every X seconds. Basically these list of items may be some data coming from database that meets a certain criteria. Now I could very well do this using setTimeout or setInterval and then manually calling <code>$.ajax</code> and set the html of div or something. However is there any plugin available for the same? I guess it would be better to use that in terms of extensibility and also in terms of UI.</p> <p>Thanks in advance :)</p>
javascript jquery
[3, 5]
1,488,580
1,488,581
Counted bytes and total bytes differ
<p>I'm writing an Android application which copies files from the assets to one file on the device's drive (no permission problems, bytes get from the assets to the drive). The file that I need to copy is larger than 1 MB, so I split it up into multiple files, and I copy them with something like:</p> <pre><code>try { out = new FileOutputStream(destination); for (InputStream file : files /* InputStreams from assets */) { copyFile(file); file.close(); } out.close(); System.out.println(bytesCopied); // shows 8716288 System.out.println(new File(destination).length()); // shows 8749056 } catch (IOException e) { Log.e("ERROR", "Cannot copy file."); return; } </code></pre> <p>Then, the <code>copyFile()</code> method:</p> <pre><code>private void copyFile(InputStream file) throws IOException { byte[] buffer = new byte[16384]; int length; while ((length = file.read(buffer)) &gt; 0) { out.write(buffer); bytesCopied += length; out.flush(); } } </code></pre> <p>The correct number of total bytes that the destination file should contain is 8716288 (that's what I get when I look at the original files and if I count the written bytes in the Android application), but <code>new File(destination).length()</code> shows 8749056.</p> <p>What am I doing wrong?</p>
java android
[1, 4]
2,606,836
2,606,837
asp.net dropdown datasource
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/7694098/converting-enumerable-range-to-a-list-of-strings">Converting Enumerable.Range to a List of Strings</a> </p> </blockquote> <p>In ASP.NET how do I populate a drop down list and also include text for the default selected state?</p> <p>For eg.</p> <p>A drop down will contain: Enter day, 1, 2, 3, 4, 5</p> <pre><code>ddlDayDropDown.DataSource = Enumerable.Range(1, 31).ToList(); ddlDayDropDown.DataBind(); </code></pre> <p>I can't add a "string" here.</p>
c# asp.net
[0, 9]
5,791,766
5,791,767
Scroll if on the right side (jQuery)
<p>i have create a gallery with jquery.</p> <p><a href="http://www.rialto-design.de/endkunden/galerie/galerie-armaturen/?album=3&amp;gallery=2" rel="nofollow">http://www.rialto-design.de/endkunden/galerie/galerie-armaturen/?album=3&amp;gallery=2</a></p> <p>so my question is, how can i make the thumbs scroll left or right. when the cursor is on the right or left side of the container.</p> <p><img src="http://i.stack.imgur.com/WW6LI.gif" alt="alt text"></p> <p>Important is, the thubs are still clickable.</p> <p>Thx</p>
javascript jquery
[3, 5]
5,005,362
5,005,363
Why Rich:toolTip not work Under rich:calendar
<p>Why is Rich:toolTip not working under rich:calendar?</p> <pre><code>&lt;td&gt; &lt;rich:calendar id="valuereq" requiredMessage="Requested Date Required" inputClass="inside_text" value="#{projectDetailManageBean.projectDetail.requestDate}" datePattern="M/dd/yy" required="true"&gt; &lt;rich:toolTip for="valuereq"&gt;Select Request Date&lt;/rich:toolTip&gt; &lt;/rich:calendar&gt; &lt;/td&gt; </code></pre> <p>This code should display a tooltip on the calendar box, but it didn't show .. why so?</p>
java php c++
[1, 2, 6]
5,932,692
5,932,693
.push breaking in for loop
<p>I have the following loop that adds an object to an array if certain criteria are met. </p> <pre><code>var form = $('form[id^="product-form"]'), submit_button = $('#add-to-cart'), attr_fields = $('.additional input[type=text]'), attr_fields_default = {}; // Get the default values for each attribute field and place into an obj attr_fields.each(function () { var field = $(this), field_id = field.attr('id'), field_val = field.val(); attr_fields_default[field_id] = field_val; }); var extra_attr = []; for (var i = 0; i &lt; attr_fields.length; i++) { var _field = $(attr_fields[i]); if (_field.val() != attr_fields_default[_field.attr('id')]) { var jsonStr = { 'add': _field.attr('id'), 'quantity': 1 }; extra_attr.push(jsonStr); console.log(jsonStr); } else { _field.attr('disabled', 'disabled').val('None'); } } console.log(extra_attr); </code></pre> <p>The code works perfectly until the last loop, although console.log( jsonStr ) outputs the last object as expected, console.log( extra_attr ) does not. It does not push the last item into the array. I even tried changing jsonStr to a dummy string 'test' and i still get the same result. </p> <p>Here is a screenshot of my chrome developer console <a href="http://cl.ly/GdHw" rel="nofollow">http://cl.ly/GdHw</a></p> <p>I should also note that I originally tried to use .each() to loop through the selectors with the exact same results</p> <pre><code> attr_fields .each(function(){ if ( $(this).val() != attr_fields_default[ $(this).attr('id') ] ) { var jsonStr = {'add': $(this).attr('id'), 'quantity': 1}; extra_attr.push( jsonStr ); console.log( jsonStr ); } else { $(this).attr('disabled', 'disabled').val('None'); } </code></pre>
javascript jquery
[3, 5]
1,461,825
1,461,826
How can I extract a URL from url("http://www.example.com")?
<p>I need to get the URL of an element's background image with jQuery:</p> <pre><code>var foo = $('#id').css('background-image'); </code></pre> <p>This results in something like <code>url("http://www.example.com/image.gif")</code>. How can I get just the "http://www.example.com/image.gif" part from that? <code>typeof foo</code> says it's a string, but the <code>url()</code> part makes me think that JavaScript and/or jQuery has a special URL type and that I should be able to get the location with <code>foo.toString()</code>. That doesn't work though.</p>
javascript jquery
[3, 5]
4,130,286
4,130,287
CMS uses jquery 1.7, theme uses jQuery 1.6 == conflict
<p>I've been given a theme to implement into a cms.</p> <p>The theme uses jQuery 1.6 and has no javascript errors.</p> <p>The CMS (concrete5) uses jQuery 1.7.1 and has no javascript errors.</p> <p>When I merge the theme into the CMS, I drop the include to jQuery (since I was to avoid including jQuery twice) and now I am getting the following errors:</p> <pre><code>Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function (ccm.app.js line 1 --&gt; ccm.app.js is part of the CMS javascript). Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function (page controls menu.js). </code></pre> <p>The script src references are in this order:</p> <pre><code>- jQuery - ccm.app.js (CMS) - page controls menu.js (CMS) - custom.js (my theme) </code></pre> <p>I realize that this isn't a lot of code to look at and troubleshoot, but does anyone know the differences between jQuery 1.6 and jQuery 1.7 that <strong>might</strong> be causing this kind of error?</p>
javascript jquery
[3, 5]
2,780,387
2,780,388
jQuery outside events plugin not funcitoning properly
<p>I have downloaded the jQuery outside events plugin as Sarfraz suggested, which seems really great, except, I cannot appear to get it functioning correctly.</p> <p>Here is my code that I'm trying to call it with:</p> <pre><code>$("#player").bind( "clickoutside", function(event){ if($('#player').is(':visible')) { $('#player').slideToggle(500); } }); </code></pre> <p>I don't understand why this isn't working.</p> <p>I think it may have a problem with this jQuery snippet form my other jQuery file:</p> <pre><code>$('#text_music').click(function() { $('#jplayer').slideToggle(500); }); </code></pre> <p>But I'm not entirely sure.</p> <p>In this context, <code>#player</code> is the <code>&lt;div&gt;</code> which contains my jPlayer plugin code, and <code>#text_music</code> is just the image which has text reading <code>Music</code>, which, upon click, should slideToggle the <code>#player</code> <code>&lt;div&gt;</code>.</p> <p>Any ideas as to why this isn't working?</p> <p>You can see the implementation (<i>attempted</i> implementation, rather) at <a href="http://www.marioplanet.com" rel="nofollow">http://www.marioplanet.com</a></p> <p>Thanks guys!</p>
javascript jquery
[3, 5]
1,447,959
1,447,960
Script to limit the no. of characters in a textbox not working. Any Ideas?
<p>I have a script which is supposed to limit the no. of characters entered in a text box or textarea. I know I can do this using maxlength attribute. But I want to use JS implementation.</p> <p>Below is the fiddle:</p> <p><a href="http://jsfiddle.net/xTrKD/" rel="nofollow">http://jsfiddle.net/xTrKD/</a></p> <p>CODE:</p> <pre><code>$(function() { function limitText(limitField, limitNum) { if (limitField.value.length &gt; limitNum) { limitField.value = limitField.value.substring(0, limitNum); } } })​ </code></pre> <p>HTML:</p> <pre><code>&lt;input type="text" id="sessionNo" name="sessionNum" onKeyUp="limitText(this,5);" /&gt; </code></pre>
javascript jquery
[3, 5]
2,969,362
2,969,363
a jQuery image-group animation
<p>I've got a div with three same images.</p> <pre><code>&lt;div&gt; &lt;img class="movlights" src="files/images/movelights.png" alt="10 years logo" /&gt; &lt;img class="movlights sec" src="files/images/movelights.png" alt="10 years logo" /&gt; &lt;img class="movlights third" src="files/images/movelights.png" alt="10 yearslogo"/&gt; &lt;/div&gt; </code></pre> <p>Each has different "absolute" position in a way that all form a row and their parent div is overflowed - hidden.</p> <p>So I animate them moving together simultaneously as a group from left to right with this code:</p> <pre><code> $(function(){ movelights(); }); function movelights(){ for(x=0;x&lt;3;x++) { $('div img:eq('+x+')').animate({left: (1400 - x*800)},24000); } }; </code></pre> <p>My problem is: How to return an image on a certain starting position before the others by queuing it again when it passes the div's right edge so that the animated pattern repeats itself!</p> <p>So I'm interested in both:</p> <ul> <li>how to queue image from end of the line to beginning</li> <li>how to loop the animated pattern</li> </ul> <p>Hope I was clear enough English isn't my native language.</p> <p>Here's some additional code:</p> <pre><code>div{ width:1000px; overflow:hidden; position:relative; } all img{ display:block; position:absolute; left:120px; } img2{ left:-678px; } img3{ left:-1400px; } </code></pre>
javascript jquery
[3, 5]
1,011,198
1,011,199
Swapping list elements with jQuery
<p>I have a list:</p> <pre><code>&lt;li&gt;item one&lt;img src="/assets/img/site/up_arrow.png" class="upArrow"/&gt;&lt;img src="/assets/img/site/down_arrow.png" class="downArrow"/&lt;/li&gt; &lt;li&gt;item two&lt;img src="/assets/img/site/up_arrow.png" class="upArrow"/&gt;&lt;img src="/assets/img/site/down_arrow.png" class="downArrow"/&lt;/li&gt; &lt;li&gt;item three&lt;img src="/assets/img/site/up_arrow.png" class="upArrow"/&gt;&lt;img src="/assets/img/site/down_arrow.png" class="downArrow"/&lt;/li&gt; &lt;li&gt;item four&lt;img src="/assets/img/site/up_arrow.png" class="upArrow"/&gt;&lt;img src="/assets/img/site/down_arrow.png" class="downArrow"/&lt;/li&gt; &lt;li&gt;item five&lt;img src="/assets/img/site/up_arrow.png" class="upArrow"/&gt;&lt;img src="/assets/img/site/down_arrow.png" class="downArrow"/&lt;/li&gt; </code></pre> <p>Each one has an up and down arrow on. In my jquery I have:</p> <pre><code>$(".upArrow").click(function() { }); $(".downArrow").click(function() { }); </code></pre> <p>How can I get it so that when a user clicks up arrow it swaps the li with the one above, and when they click down it swaps with the li below (if one exists).</p> <p>Thanks</p>
javascript jquery
[3, 5]
3,462,065
3,462,066
Using PHP and C++ for data exchange?
<p>Is it possible to send data from C++ to PHP? I have wrote a server in C++ that connects to a database, and I was wondering if it is possible at all to use the socket library built into PHP to connect to the socket server written in C++. Would it just be PHP itself? I mean, would I not use JavaScript (AJAX) to call a PHP script that might do the socket work?</p> <p>Basically, how do Google do this? I know some of their applications use C++/Java as their back-end, but is there any performance at all?</p> <p>For those wondering why I am asking this question, then the answer is I don't want to rely on PHP to handle data as I am writing a game. I would like PHP to handle the web part, but not necessarily the game client so-to-speak; and I just think C++ would be a lot efficient at sending and receiving data to store in the database.</p> <p>Has anyone done something like this and if so did you run into problems; and is this a practical solution at all?</p> <p>Thanks.</p>
php c++
[2, 6]
360,399
360,400
Does a function inside jQuery constructor do anything different?
<p>I feel like I've only ever seen this here on SO, but I can't seem to find any documentation on it. The code I am talking about is stuff like this:</p> <pre><code>$(function foo(){ alert('foo'); }); </code></pre> <p>Is there anything to that or is that just something that novices do because they think jQuery is a language? There is no scope change. It just seems completely unnecessary. Is there any method that you can invoke on this like:</p> <pre><code>$(function foo(){ alert('foo'); }).someMethod(); </code></pre> <p>The closest thing I can think of is <a href="http://api.jquery.com/jQuery.proxy/" rel="nofollow">$.proxy</a>, but that doesn't use this syntax. Am I right, is this completely unnecessary? </p>
javascript jquery
[3, 5]
1,662,648
1,662,649
Display custom ASP.NET error page without rewriting URL
<p>Currently working on error pages for my website in ASP.NET. I'm using a web configuration file to redirect the user to an error page if the server was unable to find the requested page. Below is the customErrors tag I used in my configuration file:</p> <pre><code>&lt;customErrors mode="On" defaultRedirect="~/ErrorPages/Error.aspx"&gt; &lt;error statusCode="404" redirect="~/ErrorPages/Error.aspx"/&gt; &lt;/customErrors&gt; </code></pre> <p>It's currently working but my problem is that I don't want the user to see my error page in the URL as displayed below:</p> <p>/MySite/ErrorPages/Error.aspx?aspxerrorpath=/MySite/ImaginaryPage.aspx</p> <p>I'm expecting something like what google has: <a href="http://google.com/ImaginaryPage.aspx" rel="nofollow">Google Error Page</a></p> <p>Is there a way to do this without Javascript?</p>
javascript asp.net
[3, 9]
5,062,691
5,062,692
How to reference a div using id contained in another element?
<p>I have an alphabetical index that when clicked unhides a div that contains it's content.</p> <p>Here is the HTML so I can explain properly:</p> <pre><code>&lt;ul class="index"&gt; &lt;li&gt;A&lt;/li&gt; &lt;li&gt;B&lt;/li&gt; &lt;li&gt;C&lt;/li&gt; &lt;/ul&gt; &lt;div id="index-A" class="hide"&gt;A contents&lt;/div&gt; &lt;div id="index-B" class="hide"&gt;B contents&lt;/div&gt; &lt;div id="index-C" class="hide"&gt;C contents&lt;/div&gt; </code></pre> <p><strong>When a letter is clicked, I want to unhide it's content div and also hide any other ones that are visible.</strong></p> <p>How could I do that?</p> <p>Here is what I have been trying, but am stuck at this point:</p> <pre><code>$('.index li').click(function(e) { // somehow reference the content div using: "index-" + $(this).text() }); </code></pre>
javascript jquery
[3, 5]
3,571,016
3,571,017
Create JS execution blocking dialogs using jQuery
<p>I have an existing web application which uses <code>window.showmodaldialog()</code> to show certain forms and based on the return value it executes some other JavaScripts</p> <p>For example:</p> <pre><code>var retVal = window.showmodaldialog('...'); if (retVal==XXX) callXXX(); else callYYY(); </code></pre> <p>When <code>showModalDialog()</code> is executed it blocks the JS execution on the main window until the modal is closed.</p> <p>I am trying to replace these modal Windows with jQuery dialogs but the problem is that once the <code>$(...).dialog().open()</code> is executed the JavaScript execution does not wait for the dialog to be closed.</p> <p>I know that there are jQuery APIs which allow me to configure a callback function but that involves a lot of changes for me. Is there anyway by which I can pause JavaScript execution until the dialog is closed (I must still be able to execute scripts from the dialog). </p>
javascript jquery
[3, 5]
2,453,943
2,453,944
Remove all but a specific row from a table
<p>I want to remove all rows apart from the row with id 'row0' from a table:</p> <pre><code>&lt;table class="mytable"&gt; &lt;tr id="row0" class="myrow"&gt; &lt;td&gt;aaa&lt;/td&gt; &lt;/tr&gt; &lt;tr class="myrow"&gt; &lt;td&gt;bbb&lt;/td&gt; &lt;/tr&gt; &lt;tr class="myrow"&gt; &lt;td&gt;ccc&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>But the following JQuery code removes ALL rows:</p> <pre><code>$('.mytable').children().not('#row0').remove(); </code></pre> <p>Could someone explain why this happens? I would think that the child with id 'row0' would be excluded, but obviously that's not the case.</p> <p>I have found another way to do this but still curious why the above method doesn't work:</p> <pre><code>$('.mytable').find('tr:not(#row0)').remove(); </code></pre>
javascript jquery
[3, 5]
227,286
227,287
Help to Understand PHP Code into C#
<p>I am a C# guy and got this logic into php from a website. Need to implement the same in C#.</p> <pre><code>$items = array(); while($row = mysql_fetch_assoc($query)) { //parent id $pkey = $row['parent_id']; //child id $ckey = $row['category_id']; //store this $items[$pkey]['children'][$ckey] = $row['categoryname']; } //create our list $first = true; //create our list createList($items, $first); function createList($array, $first) { //we need access to the original array global $items; //first is a flag on whether or not this is the first item in the array //we use this flag so that you don't need to initially call the function using createList($array[0]['children']) if($first){ $array = $array[0]['children']; } echo "&lt;ol&gt;\n"; foreach($array as $key =&gt; $value){ echo "&lt;li&gt;{$value}"; //if this item does have children, display them if(isset($items[$key]['children'])){ echo "\n"; createList($items[$key]['children'], false); //set $first to false! } echo "&lt;/li&gt;\n"; } echo "&lt;/ol&gt;\n"; </code></pre> <p>} </p> <p>In the above last line is it a 3 dimensional array or hashtable? it looks like its a hashtable cause [$pkey]['children'][$ckey] is bugging me..</p> <p>Can anyone convert the above code in C#? I would really appreciate.</p>
c# php
[0, 2]
1,733,464
1,733,465
How to save grid created by jquery
<p>I have create a graph using jquery but I can't save it as .jpg or .png format. Here is my code for jquery grid. Link <a href="http://ushatech.com/customer/Palletized_Material_Handling_Conveyors/build.php?num1=50&amp;num2=50" rel="nofollow">is here</a></p> <p>HTML part: <code>&lt;div id="working-area" name="working" align="center"&gt;&lt;/div&gt;</code></p> <p>Script part:</p> <pre><code>function createGrid(size) { var ratioW = Math.floor(num1*$(window).width()/$(window).width()), ratioH = Math.floor(num2*$(window).height()/$(window).height()); var parent = $('&lt;div /&gt;', { class: 'grid', id: 'idgrid', width: ratioW * size, height: ratioH * size }).addClass('grid').appendTo('#working-area'); for (var i = 0; i &lt; ratioH; i++) { for(var p = 0; p &lt; ratioW; p++){ $('&lt;div /&gt;', { width: size - 1, height: size - 1 }).appendTo("#idgrid"); } } } </code></pre> <p>please give some solution.</p>
javascript jquery
[3, 5]
3,649,662
3,649,663
How to open popup windows in background using javascript?
<p>Is it possible to open pop-up windows BEHIND the current active screen using java script?</p> <pre><code> var win= window.open(value,'_blank'); </code></pre> <p>the above script opens pop windows in browser tab but I loss active page from my sight.</p> <p>any suggestion?</p> <p>Thanks in advance</p> <p>Solution:</p> <p>As per <strong>@Brian</strong> advised,</p> <pre><code>var win=window.open(value,null,"height=400,width=600,status=yes,toolbar=no,scrollbars=yes,menubar=no,location=no"); win.blur(); </code></pre> <p>Its works in IE,FireFox and safari but <strong>not in Chrome browser</strong>. </p> <p><strong>Can any one suggest how to open multiple popup boxes in IE browser?</strong> The above script will open only one pop up in IE.</p>
javascript jquery
[3, 5]
1,582,107
1,582,108
problem with drop down list
<p>I have a drop down list control populated with items and some code to take the currently selected item value. The problem is I only get the value of the first item in the list regardless of what item is actually selected.</p> <p>Here is my code to populate the drop down:</p> <pre><code>protected void displayCreateCategories() { StoreDataContext db = new StoreDataContext(); var a = from c in db.Categories orderby c.Name select new{catName= c.Name, catId=c.CategoryID}; ddlCategory.DataSource = a; ddlCategory.DataTextField = "catName"; ddlCategory.DataValueField = "catId"; ddlCategory.DataBind(); } </code></pre> <p>To get the value of the currently selected item which in my case is always of type integer I do <code>label1.text=Convert.toInt32(ddlCategory.SelectedValue); </code> <br /><br /> I get the selected value, but it is always for the 1st item in the list. I'm pulling my hair out over this. :(</p>
c# asp.net
[0, 9]
1,774,531
1,774,532
Can running 2 document.ready make them conflict?
<p><br> In my application i am running <code>$(document).ready(</code> twice on on the same page is there going to be a conflict between them?<br> Thanks in Advance,<br> Dean </p>
javascript jquery
[3, 5]
5,153,374
5,153,375
Why this can't work - live update using jquery
<p>I am writing my code like this:</p> <pre><code>function updates_cb() { in a while loop to call append_message } function append_message(message) { append the html of message into the page now I am using selector to add callback to newly added element $(jmsg).hover(function(){console.log("hover");}) } </code></pre> <p>The problem is very weird, only the last element that added has .hover() callback setup, others don't have hover event handler setup.</p> <p>Am I doing wrong? I can't manipulate the newly added element using jQuery? </p>
javascript jquery
[3, 5]
2,814,438
2,814,439
Conversion of Date
<p>I am getting date in two different formats.<br> 1) <code>2012-01-05</code><br> 2) <code>05/01/2012</code><br> But i want this to be in the below format. <code>"5 Jan 2011"</code> </p> <p>Please help.. Now i'm having <code>String d1="2012-01-05"</code> and <code>String d2="2012-01-05".</code><br> urgent..</p>
java android
[1, 4]
4,047,962
4,047,963
How to access main window element from iframe
<p>I hope someone can help with this issue. I have a popup iframe using lytebox. I would like it that when i click a link in my iframe with the class "mylink" that it executes the ajax call and update a div in my main window with the id "mydiv". I know how to do the onclick events and the ajax call but i do not know how to access the "mydiv" from the main window and update it with the content. Any help on this would be greatly appreciated. Thanks.</p>
javascript jquery
[3, 5]
1,580,039
1,580,040
ASP.NET How to allow users to watch video in a specific date and time ?
<p>I'm developing a website that will allow registered users to watch video on specific date and range of time </p> <p>Example: User X will be allowed to watch video on Sunday at 6 pm. The video will be available only at this time.</p>
c# asp.net
[0, 9]
4,752,531
4,752,532
databinding directly to a sqldatasource
<p>in Asp.net C# I'm simply tring to bind a control to a sqldatasource that returns ONE record (one row).</p> <pre><code>&lt;asp:SqlDataSource ID="sqldatasource1" runat="server" ConnectionString="&lt;%$ ConnectionStrings:ApplicationServices %&gt;" SelectCommand="SELECT * FROM [Data_Events] WHERE ([Entry_ID] = @Entry_ID)" UpdateCommand="UPDATE Data_Events SET Resolution = @Resolution, Date_Resolved = @Date_Resolved WHERE (Entry_ID = @id)"&gt; &lt;SelectParameters&gt; &lt;tr&gt; &lt;td&gt;Author&lt;/td&gt; &lt;td&gt;&lt;%# DataBinder.Eval(sqldatasource1, "Author")%&gt;&lt;/td&gt; &lt;td&gt;Incident Date&lt;/td&gt; &lt;td&gt;&lt;%# DataBinder.Eval(sqldatasource1, "Date_Incident")%&gt;&lt;/td&gt; </code></pre> <p></p> <pre><code>&lt;%# DataBinder.Eval(sqldatasource1, "Name")%&gt; </code></pre> <p>This code is failing, what is the correct way?</p>
c# asp.net
[0, 9]
5,988,503
5,988,504
If a <li> is clicked, hide the inner div
<p>My DOM looks like this:</p> <pre><code>&lt;li id="li1"&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;/li&gt; &lt;li id="li2"&gt; &lt;div class="c1"&gt;&lt;/div&gt; &lt;/li&gt; </code></pre> <p>Using jQuery, if the first <li> is clicked, I want the inner to be hidden.</p>
javascript jquery
[3, 5]
2,766,730
2,766,731
delete rows and change pagination counters?
<p>I want change <code>1 تا 6 از 36</code>=translator to EN=> <code>1 to 6 of 36</code> after delete row(s)(with click on link <strong>DELETE</strong>) in table.<br> <strong>EXAMPLE:</strong> total rows is <code>36</code> if we delete <code>3</code> rows, this total row online change to <code>33</code> (like when that select value of select box and change this part of table).<p> You see this link that be clear: <a href="http://binboy.gigfa.com/admin/accommodation/show" rel="nofollow">http://binboy.gigfa.com/admin/accommodation/show</a> <br> Here is my full js code: <a href="http://binboy.gigfa.com/files/js/admin.js" rel="nofollow">http://binboy.gigfa.com/files/js/admin.js</a><p></p> <p>With respect</p>
javascript jquery
[3, 5]
2,479,901
2,479,902
jQuery click function for <ul><li> elements
<p>I have a unordered list looking like this:</p> <pre><code>&lt;ul id="frozen" data-name="nameOfSelect" class="tagit"&gt; &lt;li class="tagit-choice" tagvalue="2" style="padding-right: 4px;" id="tag-2"&gt; &lt;div class="tagit-label" data-value="2"&gt;kázeň&lt;/div&gt; &lt;/li&gt; &lt;li class="tagit-choice" tagvalue="1" style="padding-right: 4px;" id="tag-1"&gt; &lt;div class="tagit-label" data-value="1"&gt;žalmxxxx&lt;/div&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I need to bind an click function to all of them and get the data of the <code>id="tag-1"</code> to be used in the function. </p> <p>I have tried this:</p> <pre><code>$('#[id|="tag"]').each(function(){ var tag = this.attr('id'); var tagID = tag.replace('tag-',''); this.click(function (){ alert('index.php?s=taglist&amp;tag=' + tagID); //window.location = string; }); }); </code></pre> <p>However, for some reason it seems that this approach is wrong for the <code>&lt;li&gt;</code> element as I am having problems with the selector (it seems). Maybe I am also missing something stupid... Any ideas?</p>
javascript jquery
[3, 5]
2,882,873
2,882,874
How to run a randomly selected function in JavaScript?
<p>I'm trying to run a random function but haven't quite figured it out: </p> <pre><code>&lt;script&gt; function randomFrom(array) {return array[Math.floor(Math.random() * array.length)];} function randomchords(){randomFrom(['poop()', 'poop2()', 'poop3()']);} function poop() { $(function() {ionian_c_vi() }); } function poop2() { $(function() {ionian_c_iii() }), $(function() {ionian_c_iv() }); } function poop3() { $(function() {ionian_c_vi() }), $(function() {ionian_c_i() }), $(function() {ionian_c_ii() }); } &lt;/script&gt; </code></pre> <p>and then:</p> <pre><code>&lt;button onclick="randomchords()" &gt;Get some random chords&lt;/button&gt; </code></pre> <p>Am I on the right track?</p>
javascript jquery
[3, 5]
4,843,053
4,843,054
Triggering Script VIA URL
<p>I have this script calling a lightbox to trigger if the URL is site.com/page.html?globe=1 and it is not working here is the code:</p> <pre><code>var $j = jQuery.noConflict(); $j(document).ready(function() { var url = window.location.href; url = url.toLowerCase(); if (url.indexOf('globe=1') != -1) { $j("a#fancy").fancybox({ 'padding' : 0, 'overlayShow' : false, }); } } }); $j("a#fancy").fancybox({ 'padding' : 0, 'overlayShow' : false, }); </code></pre> <p>What is wrong and why does it not work? I have used this before for other scripts other than fancybox and I assume I am typing some code wrong.</p>
javascript jquery
[3, 5]
327,391
327,392
How to remove empty li in ul list using jquery?
<p>I have the below HTML structure:</p> <pre><code>&lt;ul&gt; &lt;li&gt;&lt;a&gt;one&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a&gt;two&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;a&gt;three&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a&gt;four&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;/li&gt; &lt;li&gt;&lt;a&gt;five&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; </code></pre> <p>I need to remove the <code>li</code> elements which are don't have any content (<code>&lt;li&gt;&lt;/li&gt;</code>).</p> <p>How can I do this in jQuery?</p>
javascript jquery
[3, 5]
2,895,675
2,895,676
Executing math equation in Android
<p>I need to be able to handle a math equation such as "(45+9)/8" in my app. I wanted to just eval it using JavaScript, but realized that I can't use javax.script in Android. So, I found WebView, but I'm having a bit of trouble using it. Most of the examples refer to using an external page with the JS code, or using "javascript: var return ...etc." I'd need to use the latter, but I've been having a bit of trouble with returning the variable to my app. </p> <p>Is it possible to have the JS eval it and then write the value to a hidden TextView?</p>
java javascript android
[1, 3, 4]
3,482,592
3,482,593
Jquery disable autocomplete in input
<p>I have this code:</p> <p>The html:</p> <pre><code>&lt;input id="register_username" type="text"&gt; &lt;input id="register_password" type="text"&gt; &lt;input id="register_repeatpassword" type="text"&gt; &lt;input id="register_email" type="text"&gt; </code></pre> <p>The Jquery:</p> <pre><code>$(document).ready(function(){ $('#register_username').attr('autocomplete','off'); $('#register_password').attr('autocomplete','off'); $('#register_repeatpassword').attr('autocomplete','off'); $('#register_email').attr('autocomplete','off'); }); </code></pre> <p>I want to disable the autocomplete feature offred by some browsers and acctually make the user type the entire field but the code is not working the dropdown menu still appear and the user still able to choose stuff the typed before. I also tried to user <code>autocomplete="off"</code> but nothing happened. What am I doing wrong here ?</p>
javascript jquery
[3, 5]