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
4,877,008
4,877,009
Dynamically set width and height of image with PHP and the such
<p>So - I have this website (<a href="http://pickture.me" rel="nofollow">Pickture</a>) which allows users to upload a photo of virtually any size. This causes a headache when it comes to displaying them. <br /><br /> Currently this happens. The Image is inside a container DIV (which I would prefer to be untouched), and is set to a width of 100% and the height is left blank. This means that all images, even if only 200x200, will be scaled to be around 600x600. <br /><br /> What I would like to happen is this. If the width of the image is greater than 650px, set the width to 100%. If the width is less than that, set the width of the image to be the width of the image (actual size). <br /><br /> I was thinking I could probably do this with a combination of jQuery and PHP - PHP to get the dimensions of the image, and jQuery to set the display dimensions based on some variables put in with PHP - eg:</p> <pre><code>&lt;script type="text/javascript"&gt; var imageWidth = &lt;?php echo 'something';?&gt; if (imageWidth &gt; 650) { $('#image').css('width', '100%'); } else { $('#image').css('width', '&lt;?php echo 'something';?&gt;'); } &lt;/script&gt; </code></pre> <p>Thanks to anyone who can help me solve this conundrum.</p>
php jquery
[2, 5]
5,807,674
5,807,675
tab container selected - all things are disappear
<p>I am using a ASP.Net and AJAX web which contain </p> <ol> <li><p>TabContainer </p></li> <li><p>gridView(grid view generated in run time and make 1 of the column as the tab page header)</p></li> <li><p>combobox</p></li> <li><p>2 textbox(date fr/to)<br> button</p></li> </ol> <p>Problem is.. after the data was retrieved.. everything look find. now i want to fire the tab container event.. <strong>autopostback set to true</strong>.. once user selected the tabs.. all the things from the page are <strong>disappear</strong>..(actually i test for other component which is set the autopost to true.. it will make some effect) its seem to be reload without pulling back the existing movement.. what can i do to enhance it? is it anything related to my coding? or setting? or concept was wrong already? before tab click <img src="http://i.stack.imgur.com/tBbUX.jpg" alt="enter image description here"> after tab is selected <img src="http://i.stack.imgur.com/W00p5.png" alt="enter image description here"></p>
c# asp.net
[0, 9]
1,248,059
1,248,060
How to find whether object exist in array or not javascript
<p>I have an array of objects in javascript. Something similar to this :</p> <pre><code> var objectArray = [ { "Name" : "A", "Id" : "1" }, { "Name" : "B", "Id" : "2" }, { "Name" : "C", "Id" : "3" }, { "Name" : "D", "Id" : "4" } ]; </code></pre> <p>Now i am trying to find out whether an object with a given property <code>Name</code> value exist in the array or not through in built function like <code>inArray</code>, <code>indexOf</code> etc. Means if i have only a string <code>C</code> than is this possible to check whether an obejct with property Name C exist in the array or not with using inbuilt functions like indexOf, inArray etc ?</p>
javascript jquery
[3, 5]
1,546,176
1,546,177
Convert localized string into decimal
<p>I have a string, that could look like "123,34", "123123,09", "1234", "123.34", "123123.09"</p> <p>(Stringrepresentation of 10,2 decimal that will be stored into a MySql DB)</p> <p>Due to the culture of the ASP.net thread may differ, because my application supports localization, I need to find a safe way to convert the most likely user input into a decimal.</p> <p>How is that possible?</p> <p>I tried various Decimal.Parse attemps, that all failed so far.</p> <p><strong>Solution</strong>:<br> My final solution was a mixed one. I used string replace to ensure my date is formatted into the specified CultureInfo I used for parsing</p>
c# asp.net
[0, 9]
4,765,996
4,765,997
Show and Hide Div for the text that comes dynamically
<p>I have a problem where we have to show/hide some text in the product description in the product detail page. The description has to be shortened upto desired number of lines and by clicking on "more" complete description is to be shown. I taken the following script from the link below: </p> <blockquote> <p><a href="http://stackoverflow.com/questions/1606336/using-javascript-substring-to-create-a-read-more-link">Using javascript substring() to create a read more link</a> </p> </blockquote> <p>And the code is as follows:</p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { var cutoff = 200; var text = $('div.contentdetail').text(); var rest = $('div.contentdetail').text().substring(cutoff); if (text.length &gt; 200) { var period = rest.indexOf('.'); var space = rest.indexOf(' '); cutoff += Math.max(Math.min(period, space), 0); } rest = text.substring(cutoff); var visibleText = $('div.contentdetail').text().substring(0, cutoff); $('div.contentdetail') .html(visibleText + ('&lt;span&gt;' + rest + '&lt;/span&gt;')) .append('&lt;a title="Read More" style="font-weight:bold;display:block;cursor: pointer;"&gt;Read More&amp;hellip;&lt;/a&gt;') .click(function() { $(this).find('span').toggle(); $(this).find('a:last').hide(); }); $('div.contentdetail span').hide(); }); &lt;/script&gt; </code></pre> <p>But with the above script the entire description is converting into text format. But since the description contains unordered lists,header tags etc. it is not considering those. How to modify the above script to display the content as it is.</p>
javascript jquery
[3, 5]
4,967,673
4,967,674
How to insert dot instead of comma in js keypress
<p>In my website i have textbox that contains currency amount separeted by dot. Users sometimes press dot on numpad, and that inserts coma in textbox. How can I convert it to dot ? I was trying to do it in keypress event but didn't menage to make it work.</p>
javascript asp.net
[3, 9]
2,361,297
2,361,298
Named Arguments in PHP
<p>In C#, there is a new feature coming with 4.0 called Named Arguments and get along well with Optional Parameters.</p> <pre><code>private static void writeSomething(int a = 1, int b = 2){ // do something here; } static void Main() { writeSomething(b:3); // works pretty well } </code></pre> <p>I was using this option to get some settings value from users.</p> <p>In PHP, I cannot find anything similar except for the optional parameters but I am accepting doing <code>$.fn.extend</code> (jQuery) kind of function :</p> <pre><code>function settings($options) { $defaults = array("name"=&gt;"something","lastname"=&gt;"else"); $settings = array_merge($defaults,$options); } settigs(array("lastname"=&gt;"John"); </code></pre> <p>I am wondering what kind of solutions you are using or you would use for the same situation.</p>
c# php asp.net
[0, 2, 9]
304,744
304,745
Creating select list with script
<p>I have got this far with my coding:</p> <pre><code> success: function(data) { $.each(data, function(item){ if (item=="") { $(select_element).append($(document.createElement("option")).attr("value", (item)).html(data[item])); } else { $(select_element).append($(document.createElement("option")).attr("value",(item)).html(data[item]+" ")); } </code></pre> <p>'item' is an object with two attributes, description and id. Created select list works basically just find, but it returns the whole object now. Can I modify the createElement function so that id would be the returnable itemValue and description itemLabel? I'm newbie.</p>
javascript jquery
[3, 5]
5,570,347
5,570,348
Jquery - resize font
<p>I want to make a menu like this : <a href="http://www.citrus7.com.br/" rel="nofollow">http://www.citrus7.com.br/</a> I've tried with textfit plugin to resize the font when i resize the window, but i cant resize each line of the menu separately. Can anyone help me, or point me in the right direction. Thank you</p>
javascript jquery
[3, 5]
2,738,111
2,738,112
jQuery deferred chaining problems
<p>Ok, I am probably missing something obvious, and although I've tried to find a similar example, I can't find one quite like what i'm wanting to do. I'm needing a series of ajax calls to run in a particular order. I'm using the following code to finalize a transaction:</p> <pre><code>showStandbyDialog(); $.when(function(){console.log('Paying Charges due before transaction');}) .always( this.applyCredit(parseFloat($(this.currentChargesTarget).html())) ) // Pay charges due before transaction .always(function(){console.log('Applying renewals');}) .always( this.applyRenewals() ) // Apply Renewals .always(function(){console.log('Paying renewal charges');}) .always( this.applyCredit(this.renewCart.length * this.renewCost) ) // Pay renewal charges .always(function(){console.log('Applying checkouts');}) .always( this.applyCheckOut() ) // Apply checkouts .always(function(){console.log('Paying checkout charges');}) .always( this.applyCredit(this.cart.length * this.checkOutCost) ) // Pay checkout charges .always(function(){console.log('Applying card replacement');}) .always( this.applyCardReplacement() ) // Apply card replacement .always(function(){console.log('Paying leftover charges');}) .always( this.applyCredit(this.cardCost) ) // Pay leftover charges .always(function(){console.log('Finalizing Transaction');}) .always( function(){ updateCharges(); bfwd.Patron.Transaction.reset(); hideStandbyDialog(); } ); // Reset Transaction and clear standby dialog </code></pre> <p>Now I have tried, .done, .then, and just about .anything() but the console.log() code in the handle function of this.applyCredit() ALWAYS logs after the console.log('Finalizing Transaction'). Every this.function() call returns a jquery deferred method in case you were wondering. </p>
javascript jquery
[3, 5]
4,614,650
4,614,651
Run JS function from parent window in child window?
<p>Want to run javascript function from parent window in child window </p> <p><strong>Example</strong> </p> <p>I have to different websites let's say <code>site1.com</code> and <code>site2.com</code></p> <p>I want from <code>site1.com</code> to open new window of URL <code>site2.com</code></p> <pre><code>new_window = window.open("site2.com/index.php", "window2"); </code></pre> <p>Then i want to run a js function <code>test()</code> on this new_window.</p> <pre><code>// Where site2.com/index.php &lt;html&gt; ...... &lt;/html&gt; &lt;script&gt; function test(){ // some code here } &lt;/script&gt; </code></pre> <p><strong>Summary</strong> </p> <p>Want to open new window (child) and run some JS functions from parent window.</p>
javascript jquery
[3, 5]
1,650,761
1,650,762
how to get current url in code behind?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/96029/get-url-of-asp-net-page-in-code-behind">Get URL of ASP.Net Page in code-behind</a> </p> </blockquote> <p>I'm trying to hold current url in string in the code behind.</p> <p>as example this is the current url address:http:www.stackoverflow.com/questions/ask/submit how I can hold this in string variable?</p> <p>please help me out.</p>
c# asp.net
[0, 9]
4,872,478
4,872,479
how to insert this javascript in php
<p>how to insert this javascript code :</p> <p>thejavascript</p> <pre><code>&lt;A HREF="javascript:void(0)" onclick="window.open('welcome.html','welcome')"&gt; &lt;/A&gt; </code></pre> <p>inside img src in php </p> <pre><code>&lt;img src="http:'.$iv[$j].'.jpg" height="220" width="200" alt="Image '.ucwords($kw).'" "thejavascript"&gt; </code></pre> <p>Thanks</p>
php javascript
[2, 3]
4,100,430
4,100,431
Loading of Master pages dynamically?
<p>Can we have the Masterpage loaded dynamicallu. I have a page that must be used in 2 different scenarios ie., using two different master pages. </p> <p>Appreciate all your help. </p> <p>Thanks, </p>
c# asp.net
[0, 9]
3,831,435
3,831,436
Ideas on how to make multiple selectable resizeable boxes in jQuery?
<p>I am trying to develop a web application that can take an image and draw multiple, resizeable boxes on the image. I have been looking into a lot of cropping plugins, but i cant seem to find what I am looking for. I just need to be able to draw multiple boxes on an image and return coordinates. I am looking for a plugin that would be easily modified for this or if anyone could give me any idea on how I could get started on this. Thanks!</p>
javascript jquery
[3, 5]
4,772,204
4,772,205
Using coordinates values for position
<p>I have following image map code.</p> <pre><code>&lt;area shape="rect" coords="213,109,320,256" href="embedded-processors" alt="Embedded Processor" class="embeded-processor" /&gt; </code></pre> <p>I can retrieve attribute coords it return "213,109,320,256", for position div I want DIV position based on this co-ords. Like top value is 213 and left is 109px. </p> <p>How I can retrieve each value and save it in local variable.</p>
javascript jquery
[3, 5]
2,807,320
2,807,321
Selecting rows in a table and replacing them with the new data
<p>I have a table with headers:</p> <pre><code>&lt;table id="my-table"&gt; &lt;thead&gt; &lt;th&gt;header1&lt;/th&gt; &lt;th&gt;header2&lt;/th&gt; &lt;th&gt;header3&lt;/th&gt; &lt;/thead&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td&gt;data1&lt;/td&gt; &lt;td&gt;data2&lt;/td&gt; &lt;td&gt;data3&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>How do I select only rows and replace them with the new data using jQuery? Only rows and not headers.</p>
javascript jquery
[3, 5]
1,671,601
1,671,602
How should I give text to textbox which will displayed in textbox at runtime
<p>This is my aspx code </p> <pre><code>&lt;asp:TemplateField HeaderText="Column Name"&gt; &lt;ItemTemplate&gt; &lt;asp:TextBox ID="TextBox1" runat="server" AutoPostBack="false" &gt;&lt;/asp:TextBox&gt; &lt;/ItemTemplate&gt; &lt;/asp:TemplateField&gt; </code></pre> <p>this is my cs code</p> <pre><code> int rowIndex =0; TextBox box1=new TextBox(); box1.Text = ((TextBox)Gridview1.Rows[rowIndex].Cells[2].FindControl("TextBox1")).Text; </code></pre> <p>Normally if we want to give value to textbox we give lkie this</p> <pre><code> &lt;asp:TextBox ID="TextBox1" runat="server" AutoPostBack="false" Text="SomeText"&gt;&lt;/asp:TextBox&gt; </code></pre> <p>but now I have textbox in gridview so I am accessing that as written above cs code. I want to give text to textbox from cs code. then How should I give text to textbox which will displayed in textbox at runtime..</p>
c# asp.net
[0, 9]
2,393,649
2,393,650
jQuery: contains selector for <option>VALUE</option>
<p>I'm trying to add a class to the H1 tag that matches the current select option.</p> <p>jQuery</p> <pre><code> var option = $('#fruits').val() $("h1:contains(option)").addClass('selected') </code></pre> <p>html</p> <pre><code>&lt;select&gt; &lt;option&gt;Select One&lt;/option&gt; &lt;option&gt;apple&lt;/option&gt; &lt;option&gt;orange&lt;/option&gt; &lt;option&gt;lemon&lt;/option&gt; &lt;/select&gt; &lt;h1&gt;apple&lt;/h1&gt; &lt;h1&gt;orange&lt;/h1&gt; &lt;h1&gt;lemon&lt;/h1&gt; </code></pre>
javascript jquery
[3, 5]
1,991,666
1,991,667
Adding week number and week ranges of a year to DropDown List in ASP.NET3.5 using JQUERY
<p>I am learning jQuery. Here I have a requirement i.e I have to add Week number and Week ranges of a year to DropDown List in ASP.NET3.5. And I have to pass selected week range to database. I am using c#.net. This should be done automatically for every year.</p> <p>How can I do this using JQUERY?</p> <p>Regards,</p> <p>JN</p>
c# jquery asp.net
[0, 5, 9]
3,439,425
3,439,426
How to get the first two numbers in an integral?
<p>How to get the first two numbers in an integral?</p> <p>For example: get 12 of the 123456 in PHP or JavaScript?</p>
php javascript
[2, 3]
5,423,367
5,423,368
C++ STL datastructures compared to Java
<p>I'm currently learning C++ and trying to get used to the standard data structures that come with it, but they all seem very bare. For example, list doesn't have simple accessors like get(index) that I'm used to in Java. Methods like pop_back and pop_front don't return the object in the list either. So you have to do something like:</p> <pre><code>Object blah = myList.back(); myList.pop_back(); </code></pre> <p>Instead of something simple like: <code>Object blah = myList.pop_back();</code></p> <p>In Java, just about every data structure returns the object back so you don't have to make these extra calls. Why is the STL containers for C++ designed like this? Are common operations like this that I do in Java not so common for C++?</p> <p>edit: Sorry, I guess my question was worded very poorly to get all these downvotes, but surely somebody could have edited it. To clarify, I'm wondering why the STL data structures are created like this in comparison to Java. Or am I using the wrong set of data structures to begin with? My point is that these seem like common operations you might use on (in my example) a list and surely everybody does not want to write their own implementation each time.</p> <p>edit: reworded the question to be more clear.</p>
java c++
[1, 6]
478,058
478,059
Javascript interaction between ASP.NET web controls
<p>I have a UserControl A which contains </p> <ul> <li>a dropdown</li> <li>a placeholder</li> </ul> <p>At runtime the placeholder will be populated with some UserControl B.</p> <p>There are certain times which I need to trap the javascript onchange event in the dropdown to call a javacript function in B (to do a clientside update of B). What is a good design/practice for how to do this? </p> <p>The naive way is to make the asp:dropdownlist a public member then send it into a public method of B:</p> <pre><code>// In controlling code ... userControlB.Initialize(userControlA.TheDropDownList); ... // In usercontrol B public void Initialize(DropDownList dropdownFromA) { dropdownFromA.Attributes.Add("onchange", "myBfunction()"); } </code></pre> <p>But something smells bad with this approach. I would like to keep A and B as loosely coupled as possible. Any better ideas?</p>
asp.net javascript
[9, 3]
1,160,244
1,160,245
Remove parent but keep children using jQuery
<p>I would like to remove the parent and keep the children in my HTML using jQuery. This works:</p> <pre><code>$('#my_span').children().insertBefore('#my_span').end().end().remove(); </code></pre> <p>However, it removes the text and comment node types - how can I amend this so that I keep the text?</p> <p>Happy to do this with pure Javascript too.</p>
javascript jquery
[3, 5]
5,631,544
5,631,545
How to Pass Control as Parameter from javascript to server side
<p>I Want to Pass Control i.e dropdown as Parameter from javascript to server side.</p> <p>e.g</p> <p>My Server Side Code </p> <pre><code>[System.Web.Services.WebMethod()] [System.Web.Script.Services.ScriptMethod()] public static void StatusSet(string iMode, DropDownList ddList) { List&lt;StatusHandler&gt; iListStatus = new List&lt;StatusHandler&gt;(); iListStatus.Add(new StatusHandler('A', "Active")); iListStatus.Add(new StatusHandler('I', "InActive")); iListStatus.Add(new StatusHandler('L', "All")); if (iMode == "i") { ddList.DataSource = iListStatus.Take(3); } else { ddList.DataSource = iListStatus.Take(2); } } </code></pre> <p>and Client Side Code is PageMethods.StatusSet(modeIndex, $("#ddlStatus"));</p>
javascript asp.net
[3, 9]
4,106,040
4,106,041
Real time bidding script
<p>I'm trying to create a bidding website just like this, <a href="http://www.quibids.com/" rel="nofollow">http://www.quibids.com/</a> What is the best way how to handle the real time bidding system? Any tips?</p> <p>Eg. When clicking the BID button, how to make it real time to the other users that are being outbid?</p>
c# asp.net
[0, 9]
4,142,711
4,142,712
download zip files by use of reader in c#
<p>I have been working on this application that enables user to log in into another website, and then download specified file from that server. So far I have succeeded in logging on the website and download the file. But everything ruins when it comes to zip files.</p> <p>Is there any chunk of code that could be helpful in reading the .zip files byte by byte or by using stream reader?</p> <p>I m using <code>downloadfile()</code> but its not returning the correct zip file.</p> <p>I need a method by which I can read zip files. Can I do it by using <code>ByteReader()</code></p> <p>The code used to download zip file is</p> <pre><code>string filename = "13572_BranchInformationReport_2012-05-22.zip"; string filepath = "C:\\Documents and Settings\\user\\Desktop\\" + filename.ToString(); WebClient client = new WebClient(); string user = "abcd", pass = "password"; client.Credentials = new NetworkCredential(user, pass); client.Encoding = System.Text.Encoding.UTF8; try { client.DownloadFile("https://web.site/archive/13572_BranchInformationReport_2012-05-22.zip", filepath); Response.Write("Success"); } catch (Exception ue) { Response.Write(ue.Message); } </code></pre> <p>Thanks in advance.</p>
c# asp.net
[0, 9]
4,544,392
4,544,393
C# Call Event Handler Dynamic
<p>I am trying to save all the controls from one WebForm using a serialized Dictionary (controlId - string, controlValue - string). Next i want to deserialize that Dictionary and dynamically fill the controls with their values.</p> <p>The problem is that some of my controls have AutoPostBack true and also event handlers. <strong>Is there a way to dynamically call these event handlers?</strong> I want to avoid another switch by control's id.</p> <p>Ex:</p> <pre><code>foreach (KeyValuePair&lt;string, string&gt; kvp in dict) { Control c = findControlRecursive(Page, kvp.Key); if (c != null) { switch (c.GetType().Name) { case "TextBox": ((TextBox)c).Text = kvp.Value; if (((TextBox)c).AutoPostBack) ....... </code></pre> <p>EDIT:</p> <p>Let's say that I have 10 different forms. each has about 50 controls. I want to add/edit a set of data. I try to avoid tables in database with columns for each control, that's why I want to use serialization.</p>
c# asp.net
[0, 9]
4,083,634
4,083,635
how can I make a text entry field
<p>How can I make a text entry field that takes the input characters and displays it in another place, character by character as a the typest type them!</p>
php javascript
[2, 3]
4,960,711
4,960,712
JQuery Show Hidden Div command inside function
<p>I have a JQuery function:</p> <pre><code>function MyFunction() { //I need a command here to show a hidden div .... } &lt;div id="hiddenDiv" style="display:none"&gt;&lt;/div&gt; </code></pre> <p>Basically, I need to Div above to show when the function is called.</p> <p>Thanks</p>
javascript jquery
[3, 5]
4,757,798
4,757,799
jQuery show ax external PHP page in a DIV
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/6634903/how-to-show-a-page-where-a-div-is-with-jquery">How to show a page where a DIV is with jQuery</a> </p> </blockquote> <p>Hello I have a DIV in the page index.html:</p> <pre><code>&lt;div id="form"&gt;&lt;/div&gt; </code></pre> <p>Now I need a way with jQuery to show another page inside that DIV. The page I need to call and load there is contact.php It is a simple HTML + PHP contact form. Is there a way to load with jQuery the contents of contact.php inside index.html page where the DIV is?</p> <p><strong>Please remember that the contact.php page contains some javascript codes that must be fully working. So propably the jQuery.load function will not work in this case.</strong></p> <p>Thanks for your help!</p>
php jquery
[2, 5]
1,475,600
1,475,601
Not able to get the value of Radio Button
<pre><code>&lt;input type="radio" name="animal" id="cat" value="Cat" /&gt; &lt;label for="cat"&gt;Cat&lt;/label&gt; &lt;input type="radio" name="animal" id="radio-choice-2" value="choice-2"/&gt; &lt;label for="radio-choice-2"&gt;Dog&lt;/label&gt; &lt;input type="radio" name="animal" id="radio-choice-3" value="choice-3" /&gt; &lt;label for="radio-choice-3"&gt;Hamster&lt;/label&gt; &lt;input type="radio" name="animal" id="radio-choice-4" value="choice-4" /&gt; &lt;label for="radio-choice-4"&gt;Lizard&lt;/label&gt; &lt;input type="button" value="Get Radio Button Value" onclick="getValue();" </code></pre> <p>I want to get the value of selected Radio Button on click of button I had written the code</p> <pre><code>function getValue () { alert("Value is :"+$('input[name=animal]:checked').val()); } </code></pre> <p>But its not working and getting Undefined</p> <p><strong>Update:</strong> </p> <p>I have used js of Jquery and jquerymobile for jquery its for fine but as i am using it for mobile app so i need both the js library so in second case it didnot work.</p> <pre><code>&lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.css" /&gt; &lt;script src="http://code.jquery.com/jquery-1.7.1.min.js"&gt;&lt;/script&gt; &lt;script src="http://code.jquery.com/mobile/1.1.0-rc.1/jquery.mobile-1.1.0-rc.1.min.js"&gt;&lt;/script&gt; </code></pre> <h2><strong>[Solved]</strong></h2>
javascript jquery
[3, 5]
2,499,882
2,499,883
Passing a String from one method to another method
<p>Sorry for this newbie simple question, but I need to pass a String from one method to another method and now I'm a bit clueless</p> <p>the String values (callbackURL &amp; donationId) I wanna pass are inside this method:</p> <pre><code>public void postData() { . . . . String callbackURL = tokens.nextToken(); String donationId = tokens.nextToken(); } </code></pre> <p>and I want to pass the values to another method, let's say it's called <code>private examplePayment()</code>. How am I able to perform that? Thank you</p>
java android
[1, 4]
5,203,925
5,203,926
Draw image using mouse
<p>I need to create a web page where i can draw a image using mouse (similar to paint).is it possible in c# ,asp.net or silver light please help</p>
c# asp.net
[0, 9]
1,815,453
1,815,454
Javascript: Acceptable way to referencing `this` from given two snippets
<pre><code>var me = null; var testFn = (function() { me = this; return { me1: me, fn1 : function() { me = this; return { me2 : me, fn2 : function() { me = this; return { me3: me } } } } } })(); </code></pre> <p><strong>OR:</strong></p> <pre><code>var testFn = (function() { var me = this; return { me1: me, fn1 : function() { var me = this; return { me2 : me, fn2 : function() { var me = this; return { me3: me } } } } } })(); </code></pre> <p>Between two segments given above, which one is best way to referencing <code>this</code>. Is there any other way best, please suggest.</p> <p>Thanks.....</p>
javascript jquery
[3, 5]
6,014,061
6,014,062
C++ or Java for android?
<p>I am thinking about picking up android development in my free time. I see that development is possible in Java and C++ but the latter is limited. </p> <p>I am much more comfortable with C++.</p> <p>So my question is what limitations exist with C++ on Android? Will I be able to develop full apps with it, or will I eventually have to learn Java?</p>
java c++ android
[1, 6, 4]
3,673,244
3,673,245
Adding a jQuery Click handler
<p>I have following div in a page (I can not modify). </p> <pre><code> &lt;div id=":0.control"&gt;Click me&lt;/div&gt; </code></pre> <p>Now I want to add a jQuery Click handler </p> <pre><code>$("#:0.control").click(function () { alert('Clicked'); } ); </code></pre> <p>Above gives error. Any solution??</p>
javascript jquery
[3, 5]
3,215,618
3,215,619
How to get proper values from Polar heart rate monitor
<p>My android application is getting data from Polar Heart Rate Monitor through Bluetooth connection. My problem is that I am getting such a string: ��������������������������������������������������</p> <p>My code for getting the data:</p> <pre><code> final Handler handler = new Handler(); final byte delimiter = 10; //This is the ASCII code for a newline character stopWorker = false; readBufferPosition = 0; readBuffer = new byte[1024]; workerThread = new Thread(new Runnable() { public void run() { while(!Thread.currentThread().isInterrupted() &amp;&amp; !stopWorker) { try { int bytesAvailable = mmInputStream.available(); if(bytesAvailable &gt; 0) { byte[] packetBytes = new byte[bytesAvailable]; mmInputStream.read(packetBytes); for(int i=0;i&lt;bytesAvailable;i++) { byte b = packetBytes[i]; if(b == delimiter) { byte[] encodedBytes = new byte[readBufferPosition]; // System.arraycopy(readBuffer, 0, encodedBytes, 0, encodedBytes.length); final String data = new String(encodedBytes, "ASCII"); readBufferPosition = 0; handler.post(new Runnable() { public void run() { pulsText.setText(data); } }); } else { readBuffer[readBufferPosition++] = b; } } } } catch (IOException ex) { stopWorker = true; } } } }); workerThread.start(); </code></pre> <p>I tried to change this line in few ways but I am still getting incorrect data:</p> <pre><code> final String data = new String(encodedBytes, "ASCII"); </code></pre> <p>How can I solve this issue ?</p> <p>Please help !!!</p>
java android
[1, 4]
5,117,226
5,117,227
how big of a issue is screen resolution with android development
<p>I'm getting into app/game development for android and I just wanted to know how hard it is to make your games work with all phones. or do the phones just scale the app to fit with the screens? thanks for any help</p>
java android
[1, 4]
4,308
4,309
Slide div from x,y to x,y?
<p>When someone click on my fields on my virtual game, i get my current left and top cordinates with this:</p> <pre><code> function moveDiv(fromSeat, toSeat){ var fromTop = $('#seat-' + fromSeat).css("top"); var fromLeft = $('#seat-' + fromSeat).css("left"); var toTop = $('#seat-' + toSeat).css("top"); var toLeft = $('#seat-' + toSeat).css("left"); /** Move a div from point {"fromTop", "fromLeft"} =&gt; {"toTop", "topLeft"} **/ } </code></pre> <p>I am stuck here, i tried to make a $('...').animate({}); but could not get it working. I want div "#test" to move from point {"fromTop", "fromLeft"} => {"toTop", "topLeft"}</p>
javascript jquery
[3, 5]
4,597,390
4,597,391
jQuery Live traversal parent() selector
<pre><code>$(".hovertip").parent().live('hover', function() { ... </code></pre> <p>The above code doesn't seem to register. </p> <p>This doesn't seem to work either:</p> <pre><code>$(".hovertip").parent().live({ mouseenter: function() { ... </code></pre> <p>Any examples of .live, .delegate, .bind, or .on working with a jQuery selector and a .parent() selector with .hover() or mouseenter: and mouseleave:?</p> <hr> <p>Update: I've created a separate question to address the dynamic DOM issue this Question has raised: <a href="http://stackoverflow.com/questions/12948251/jquery-on-with-a-parent-and-dynamic-selector">jQuery .on() with a .parent() and dynamic selector</a></p>
javascript jquery
[3, 5]
5,168,914
5,168,915
jQuery DatePicker, how to show value in input field from database
<p>can't find solution to this issue. So i have datepicker input field, it works fine, i can choose date and save it to database. But when i want to edit this saved value in edit_profile.php this field is empty, i need to see the user specified date. How to do it?</p> <p>Datepicker function:</p> <pre><code>$(function() { $( "#datepicker" ).datepicker({ dateFormat: "yy-mm-dd", changeMonth: true, changeYear: true }).val('&lt;?php echo $age;?&gt;'); }); </code></pre> <p>Input:</p> <p><code>&lt;input name="datepicker" type="text" id="datepicker" class="date_picker" value="" /&gt;</code></p> <p>what to do ?</p>
php jquery
[2, 5]
4,453,322
4,453,323
Check if asp Checkbox is checked in a row of a GridView with Javascript
<p>I have a grid view and I want to see if the checkbox in the first column is checked. If the check box is checked it opens a new window. I cannot figure out how to see if the checkbox is checked. Please help the function below is not working and I can't figure out why.</p> <pre><code>function mapSelectedClick() { var CustomerIDs = ""; var grid = document.getElementById('&lt;%=grdCustomers.ClientID %&gt;'); for (var i = 1; i &lt; grid.rows.length; i++) { var Row = grid.rows[i]; var CustomerID = grid.rows[i].cells[1].innerText; if (grid.rows[i].cell[0].type == "checkbox") { if (grid.rows[i].cell[0].childNodes[0].checked) { customerIDs += CustomerID.toString() + ','; } } } customerIDs = customerIDs.substring(0, customerIDs.length-1); window.open("MapCustomers.aspx?CustomerIDs=" + customerIDs); } </code></pre>
javascript asp.net
[3, 9]
366,642
366,643
Is there something I should know about the jquery .text method?
<p>I'm learning about the <a href="http://api.jquery.com/jQuery.data/" rel="nofollow">.data method</a> and saw this in the code:</p> <pre><code>$("span").text("" + value); </code></pre> <p>Q: Is there a reason why the author put ("" + value) instead of simply (value)?</p>
javascript jquery
[3, 5]
4,341,176
4,341,177
Strange javascript chrome issue with menu
<p>Visit the following site in chrom and teh first time the page loads the top nav displays on two lines, if you click to another page then home again the top nav displays correctly (all on one line), why is this?</p> <p>I thinkit may be javascript related but can't get to the bottom of it.</p> <p>Any ideas?</p> <p><a href="http://berrisford.gumpshen.com" rel="nofollow">http://berrisford.gumpshen.com</a></p>
javascript jquery
[3, 5]
3,474,162
3,474,163
Finding a visible div that is not hidden Jquery/Javascript
<p>Ok so i have two div's which are hidden using jquery's <code>.hide();</code> onload</p> <p>I have two function to <code>.show();</code> them</p> <pre><code>function showIncorrectChar() { $("#csq-incorrect-characters").show(); } function showMinChar() { $("#csq-min-characters").show(); } </code></pre> <p>Using Jquery/Javascript i need to find whether one of those div's are visible if they are i want it to do nothing if they aren't i need to call it</p> <pre><code>hideResultsTableContainer(); showResultsTree(); </code></pre>
javascript jquery
[3, 5]
563,391
563,392
javascript & jQuery scope question
<p>I have the following method:</p> <pre><code> function priceRange(FESTIVALID){ jQuery.ajax({ url : '/actions/festheads.cfc?method=getPriceRangeByGUID', type : 'POST', data : 'FESTIVALID='+FESTIVALID, dataType: 'json', success : function(data) { console.info("AJAX:qPrices",data.MINPRICE); formatedPriceRange = '$ '+data.MINPRICE; console.info("AJAX:formatedPriceRange", formatedPriceRange); }//success });//ajax; // return formatedPriceRange; }; </code></pre> <p>The second console.info correctly displays the formatedPriceRange, but outside the function is undefined.</p> <p>how can I access this variable out side the priceRange function? Thanks</p>
javascript jquery
[3, 5]
2,662,425
2,662,426
How to evaluate data return boolean from jQuery $.get
<pre><code>$('#my_theme').click ( function() { $('#my_theme option').each(function(){ //how do I test for this $.get to return true? if ($.get('&lt;?php echo get_bloginfo('template_directory') ?&gt;/getStyle.php', {template: $(this).val()})==true) { $(this).attr("disabled","disabled"); } }); } ); &lt;?php //getStyle.php $myTemplate = $_REQUEST['template']; $file = "styles/".$myTemplate."/style.css"; if (file_exists($file)) { return true; } else { return false; } ?&gt; </code></pre>
php jquery
[2, 5]
580,338
580,339
save input fields status with jquery, send to db to read later
<p>I'm trying to save a snapshot of an html page. I'm quite satisfied with what I've achieved but I cannot save the exact status of each input field. for instance if I send to the db this:</p> <pre><code> data = data+"&amp;knobs="+encodeURIComponent($('#knobs').html()); data = data+"&amp;html="+encodeURIComponent($('#pane').html()); </code></pre> <p>and I ask it back later with: </p> <pre><code> $('#pane').html((data.html)); $('#knobs').html((data.knobs)); </code></pre> <p>the input fields are not correct, they miss the value attribute and have the default value instead. since I wouldn't like to make a variable for every damn object in the page (a lot) I'm here to ask if there's any way to have an exact snapshot of the html page.</p> <p>Example:</p> <p>if I send to the database the html() and an input field has "movie" as .val() when I pull the html from the database it is:</p> <pre><code>&lt;input type="text" value="default value"&gt; </code></pre> <p>I've tried some stupid hack but none of them did work. I'd be very glad to hear from you.</p> <p>bye</p>
javascript jquery
[3, 5]
5,258,144
5,258,145
Add options dynamically in combo box using Jquery
<p>When i add a new option to a DropDownList using jQuery, it is duplication the values whenever i use that dropdownlist.</p> <p>For an example : </p> <pre><code> var myOptions = { val1 : 'Suganthar', val2 : 'Suganthar2'}; $.each(myOptions, function(val, text) { $('#mySelect').append(new Option(text, val)); }); </code></pre> <p>Suganthar, and Suganthar2 are duplicatiing values. </p> <p>Could anyone give me some idea to rectify this issue</p>
javascript jquery
[3, 5]
3,435,219
3,435,220
How do I get the value of a form element that has brackets in the ID?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1239095/find-dom-element-by-id-when-id-contains-square-brackets">Find DOM element by ID when ID contains square brackets?</a> </p> </blockquote> <p>I am unable to get the value of form elements that are somewhat crazy. For example I have a HTML form element that "has" to have the name of "<code>data[User][notify_one_day_out]</code>". The problem is that I am unable to get the value of the form element. </p> <pre><code>&lt;label for="data[User][notify_one_day_out]"&gt;One day away:&lt;/label&gt; &lt;select name="slider" id="data[User][notify_one_day_out]" data-role="slider"&gt; &lt;option value="0"&gt;OFF&lt;/option&gt; &lt;option value="1" selected="selected"&gt;ON&lt;/option&gt; &lt;/select&gt; </code></pre> <p>However </p> <pre><code>alert( $("#data[User][notify_one_day_out]").val()); </code></pre> <p>comes out as undefined. Any help?</p>
javascript jquery
[3, 5]
3,650,160
3,650,161
How can I replace the onclick action (with regex) using javascript / jQuery?
<p>How can I use jQuery to replace part of the <code>onclick</code> property / attribute? In the example below I would like to replace <code>delete_image</code> with <code>do_delete_image</code>:</p> <h3>Sample HTML</h3> <pre><code>&lt;a href="#" onclick="delete_image(1234)" &gt;Delete Image&lt;/a&gt; </code></pre> <h3>My Attempt</h3> <pre><code>jQuery('a').each(function(){ var action = $(this).prop('onclick').replace('delete_image','do_delete_image'); $(this).prop('onclick',action); }); </code></pre> <h3>Error</h3> <p>Google chrome is throwing this error:</p> <blockquote> <p>TypeError: Object function onclick(event) { delete_image(1234);return false; } has no method 'replace'</p> </blockquote> <p>How can I make this work? ps: This is a bookmarklet set to work with someone else's code.</p>
javascript jquery
[3, 5]
327,298
327,299
javascript stacking bug
<p>I have this code:</p> <pre><code> $jq('.pop-tip').click( function(event) { width = ''; height = ''; var img = new Image(); img.onload = function() { width = 'width='+(this.width + 240); height = 'height='+(this.height + 360); } img.src = 'http://www.domain.com/uploads/2011/10/dealoftheweek.jpg'; destination = $jq(this).attr('title'); postPop = $jq(this).attr('href'); alert ( width ); window.open(postPop, 'tip_pop',''+ width +', '+ height +', scrollbars=0' ).focus(); window.open(destination, '_parent','' ); event.preventDefault(); )}; </code></pre> <p>For some reason it only works with the alert() just above the window.open call why is this and how can i fix it?</p>
javascript jquery
[3, 5]
5,302,250
5,302,251
Adding functions with jquery replace() markup
<p>I have a jquery replace() putting in list items that I want to attach a function to. I don't know exactly how to do this though.</p> <pre><code>function replaceListItems(){ $('ul.options').replaceWith('&lt;ul class="options"&gt;&lt;li class="btn"&gt;&lt;img src="btn.png" /&gt;&lt;/li&gt;&lt;/ul&gt;');} </code></pre> <p>Here's the function I'd like to attach:</p> <pre><code>$("ul.options li").click(function(){myFunction()}); </code></pre> <p>Seems like it gets removed if I assign it before the list items gets replaced/created.</p> <p>Thanks in advance for the help! -m</p>
javascript jquery
[3, 5]
1,647,795
1,647,796
Binding database data to the GridView in ASP.Net
<p>I try to bind database data to the gridview in c# and asp.net. But I couldn't see the datas in the gridview.Rows are added to the gridview but they are empty. When I run that query in SQLServer, it gives the correct result.I didn't add or change any code to the asp part.Should I? I couldn't find where is the problem :( please help..</p> <pre><code>myConnection = WebConfigurationManager.ConnectionStrings["KutuphaneConnectionString"].ConnectionString; connect = new SqlConnection(myConnection); command = new SqlCommand(); connect.Open(); command.Connection = connect; string komut = "SELECT K.ad,K.yazar,K.baskiNo,O.sonTeslimTarihi FROM OduncIslemleri O,Kitap K WHERE O.kullaniciId=" + Session["id"] + " AND O.kitapId = K.id;"; try { SqlCommand sqlCommand = new SqlCommand(); sqlCommand = connect.CreateCommand(); sqlCommand.CommandText = komut; SqlDataAdapter sda = new SqlDataAdapter(sqlCommand.CommandText, connect); SqlCommandBuilder scb = new SqlCommandBuilder(sda); //Create a DataTable to hold the query results. DataTable dTable = new DataTable(); //Fill the DataTable. sda.Fill(dTable); GridView1.DataSource = dTable; GridView1.DataBind(); } catch (SqlException) { //Console.WriteLine(e.StackTrace); } reader.Close(); connect.Close(); </code></pre>
c# asp.net
[0, 9]
1,399,606
1,399,607
HTML form to a word editor
<p>I have made a form as below:</p> <ul> <li>name: text area</li> <li>address: text area</li> <li>phone number: number txt area</li> <li>submit: button</li> </ul> <p>Now when I click on the submit button, the name, address, and tele no. fields should automatically get filled into a letter which uses the same label which goes as follows :</p> <pre><code>Dear [name], This is to inform you that ... You can contact the undersigned. [tele no], [address] </code></pre> <p>I have made the form, now I am trying to match the label's innerHTML and the word in the brackets. If it is the same, then the value has to get stored in the letter.</p>
php javascript jquery
[2, 3, 5]
449,687
449,688
Select distinct elements in listview when click item
<p>I have a list view with custom adapter, with an Image Button and a Text View.</p> <p>I want to open a context menu when a press is made on the Image Button, and open another context menu if i press the Text View.</p> <p>How can I do this??</p> <p>This is my onClickListener</p> <pre><code>lv.setOnItemClickListener(new OnItemClickListener() { public void onItemClick(AdapterView&lt;?&gt; parent, View view, int position, long id) { if (id == view.findViewById(R.id.label).getId()) //label press { TextView text = (TextView) view.findViewById(R.id.label); registerForContextMenu(text); openContextMenu(text); } else //imageButton press { ImageButton ib= (ImageButton) view.findViewById(R.id.image); registerForContextMenu(ib); openContextMenu(ib); } } }); </code></pre>
java android
[1, 4]
2,579,650
2,579,651
Database not working in exported apk?
<p>I export my application to .apk file, sign it then install it. But when I run my App, it displays an error because there's no data in my database. The database was created as a new one when I installed the application, so all the data were lost! How can I include database data when exporting an Android application? I check it an eclipse DDMS File explorer.the database does not have a any tables. it's copying database partily in my asset folder.</p>
java android
[1, 4]
3,496,583
3,496,584
Trying to put some javascript into an ASP.NET page
<p>I have a javascript link which I need to appear in a table on my aspx page. Hard coding it as a literal isn't working right. Consultation with the script's provider suggests I shouldn't hard-code it, but should embed it using ScriptManager. How do I get the link as javascript into the appropriate place in my page (it goes in a table)? I have this code to register the script:</p> <pre><code>string myScript = "http://forms.aweber.com/form/85/1556724385.js"; ClientScript.RegisterClientScriptBlock(this.GetType(), "MyScript", myScript); </code></pre> <p>I want this link to appear in this table cell:</p> <pre><code>&lt;asp:TableRow ID="TableRow3" runat="server"&gt; &lt;asp:TableCell ID="TableCell4" runat="server" HorizontalAlign="Center"&gt; &lt;/asp:TableCell&gt; &lt;/asp:TableRow&gt; </code></pre> <p>Not clear on how to do this... insert into some control inside the cell, such as a Panel? And I am unclear on how to "emit" the script.</p> <p><strong>Edited to add:</strong></p> <p>After communicating with the vendor, it is clear that trying to do what I am trying to do in an ASP.NET page will not work -- at least with the current version of the product. So I've accepted @cccason's answer, since it comes closest to what the answer would be if the situation were otherwise.</p>
javascript asp.net
[3, 9]
5,723,904
5,723,905
PHP and JS within HTML
<p>This is what I am trying to do:</p> <p>I have a data.php page.</p> <p>In this page I have mostly HTML. Within the HTML I have some PHP code, designated by</p> <pre><code>&lt;?php ?&gt; </code></pre> <p>Now, I am trying to insert JavaSript with in the PHP; something like below:</p> <pre><code>&lt;?php &lt;script type="text/javascript"&gt; &lt;/script&gt; ?&gt; </code></pre> <p>But I get 'syntax error' notification from Adobe Dreamweaver.</p> <p>What am I doing wrong here?</p> <p>Thanks for any help.</p>
php javascript
[2, 3]
5,134,644
5,134,645
Modifying a String
<p>I am getting a String into my app which is </p> <pre><code>3-9-2012@17:32@4-9-2012@17:32@Vietnam@$@2-10-2012@17:32@4-10-2012@17:32@Vietnam@$ </code></pre> <p>I need to convert that String into something like</p> <pre><code>3-9-2012 17:32@4-9-2012 17:32@Vietnam@$@2-10-2012 17:32@4-10-2012 17:32@Vietnam@$ </code></pre> <p>Please help me with a solution so that I can get the desired result. Thanks</p>
java android
[1, 4]
621,605
621,606
Accessing label text property giving error in asp.net
<p>I am generating 10 labels on fly from code behind and I can see them when i run the page. But its giving an error when i try to access the label.text property. Its giving this error System.NullReferenceException: Object reference not set to an instance of an object.</p> <pre><code>for (int hf = 1; hf &lt;= dfta2.Rows.Count; hf++) { Label lbl = new Label(); lbl.ID = "labeltest" + hf; lbl.Text = "1"; lbl.ClientIDMode = System.Web.UI.ClientIDMode.Static; form1.Controls.Add(lbl); } string variable3 = "labeltest" + i; Label lbl2 = form1.FindControl(variable3) as Label; lbl2.Text = "2"; </code></pre> <p>i is just incremented by 1 every time I click the button. Any idea why its null ?</p>
c# asp.net
[0, 9]
5,566,775
5,566,776
Window Open from jquery click
<p>How can I make this more secure and safe:</p> <ul> <li>Strip unsafe characters from title</li> <li>Prevent undefined errors</li> </ul> <p>Code so far:</p> <pre><code>// Open HREF in popup window $('.external').bind('click', function () { var url = $(this).attr("href"); var title = ($(this).attr("data-popup-title")) ? $(this).attr("data-popup-title") : $(this).attr("title"); var image = $(this).attr("data-popup-image"); var width = ($(this).attr("data-popup-width")) ? $(this).attr("data-popup-width") : '626'; var height = ($(this).attr("data-popup-height")) ? $(this).attr("data-popup-height") : '436'; window.open('http://www.facebook.com/sharer.php?s=100&amp;amp;p[title]=' + title + '&amp;amp;p[url]=' + url + '&amp;amp;&amp;p[images][0]=' + image, 'sharer', 'toolbar=0,status=0,width='+width+',height='+height); return false; }); </code></pre> <p>Also is it best practice to <code>return false</code> or use the <code>preventDefault()</code>?</p>
javascript jquery
[3, 5]
3,913,091
3,913,092
Array textboxes with onchange event
<pre><code>&lt;INPUT name="Qty[]" id="Qty[]" type="text" class="south" /&gt; &lt;INPUT name="Amount[]" id="Amount[]" type="text" class="south"/&gt; &lt;INPUT name="TotalAmount[]" id="TotalAmount[]" type="text" class="south" disabled="disabled"/&gt; </code></pre> <p>Here i have problem with my code that i need to calculate multiply the first two textboxes. and that result will be appear into the last one, i mean third textbox as TotalAmount. Could you help me? here three textboxes appeared in single row with add button. when i submit the add button new created with three boxes again. I need to finish it in jquery of java script. please help me guys</p>
javascript jquery
[3, 5]
1,987,719
1,987,720
Jquery collapsible region
<p>I am trying to make sections of page collapsible. No plan to use accordion, but simple hide/show to save screen space. See the sample code below. The first link has to click twice to make the section hide, and the second one works fine. Neglect this issue, if you can suggest a better way to do it.. In this example, div1 is in open position and div2 hidden initially.</p> <p>thanks, bsr.</p> <hr> <pre><code>&lt;!doctype html&gt; &lt;head&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;a class="toggle" href="#"&gt;Hide&lt;/a&gt; &lt;div class="toggle"&gt; &lt;p&gt;First div&lt;/p&gt; &lt;/div&gt; &lt;a class="toggle" href="#"&gt;Show&lt;/a&gt; &lt;div class="toggle" style="display: none"&gt; &lt;p&gt;Second div&lt;/p&gt; &lt;/div&gt; &lt;script type="text/javascript"&gt; jQuery().ready(function() { $("a.toggle").toggle( function() { $(this).text("Hide"); $(this).next("div.toggle").show(); }, function() { $(this).text("Show"); $(this).next("div.toggle").hide(); } ); }); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre>
javascript jquery
[3, 5]
2,434,780
2,434,781
jQuery selector question
<p>I have a span and an anchor inside a table cell. I have the anchor set up to show a tooltip. I would like the text inside the span to be used for the tooltip. How can I select this text in jQuery?</p> <pre><code> &lt;td class="row-head" colspan="5"&gt;&lt;span class="tip-text"&gt;Complete Coverage&lt;/span&gt;&lt;a href="#" class="help"&gt;&lt;/a&gt;&lt;/td&gt; </code></pre> <p>JQuery code - the current selector always finds the first instance only for all tips.</p> <pre><code>$(document).ready(function() { $('.help').qtip({ style: { name: 'cream', tip: true }, content: { text: $(this).find('span.tip-text').html() } }); }); </code></pre> <p>Thanks</p>
javascript jquery
[3, 5]
3,335,147
3,335,148
accessing the children views of a View in Android
<p>I am quite new to Java, let alone Android. I am stuck with a problem that I encountered while instrumenting (using the instrumentation framework of android) the code of a Android project. I have a ListView and using the getTouchables() API I have store the view in a ArrayList. When in debug session, I saw that each view has children (mChildren) when expanded I could see that there is a "ImageView" and "TextView" present. when the "TextView" is expanded, I could access the mText variable which contains the text value I am looking for. In brief, the value I am looking for, when looking at the "variables" window of the debug perspective of Eclipse, is present at 'myview->mChildren->[1] (TextView)->mText->value'</p> <p>Here "myview" is the name of the object of View class.</p> <p>how do I access/ read the content of the "value" variable?</p> <p>Please let me know if you need any info in this regard?</p> <p>Thank you -BA</p>
java android
[1, 4]
613,324
613,325
How to change an element to be unclickable after clicking it once using Jquery or Javascript
<p>The code is:</p> <pre><code>&lt;a href="#" style="color:black" onClick="Record($id)"&gt;Done&lt;/a&gt; </code></pre> <p>I want this part becomes unclickable once if it is clicked, how to achieve this using Jquery or Javascript?</p>
javascript jquery
[3, 5]
3,683,357
3,683,358
Highlight the selected row in data list
<p>I have a DataList on ym web page, from which a user can choose a certain option within the DataList row.</p> <p>I use the <code>ItemCommand</code> of DataList for this. Actually, I want to highlight the selected row when the user clicks on the item in the row.</p> <pre><code>&lt;ItemTemplate&gt; &lt;tr&gt; &lt;td style="text-align:center"&gt;&lt;asp:LinkButton ID="Item" Text='&lt;%#Eval("Item")%&gt;' CommandName="select" runat="server" /&gt; &lt;br /&gt;&lt;/td&gt; &lt;td style="text-align:center"&gt;&lt;asp:Label ID="lbQuery" Text='&lt;%#Eval("Query")%&gt;' runat="server" /&gt;&lt;br /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; </code></pre> <p>As shown above, the user can click on the LinkButton to choose an item. How do I highlight the corresponding row or only the cell?</p>
c# asp.net
[0, 9]
2,997,188
2,997,189
How do I detect a jquery trigger events completion?
<p>I'm trying to trigger a second event dependent on the first like so:</p> <pre><code>... $('#productFamilyId').val(data.contents.productfamily); $('#productFamilyId').trigger('change', function() { $('#productId').val(data.contents.product); $('#productId').trigger('change'); }); </code></pre> <p>It's not waiting for the first trigger to complete before attempting to trigger the second event. Is it possible to wait for the first trigger to complete?</p>
javascript jquery
[3, 5]
2,015,358
2,015,359
Focus on textbox based on URL
<p>I have two forms on one page and want to have the input boxes focused based on the URL.</p> <p>So for example: domain.com/Default.aspx#login and domain.com/Default.aspx#register</p> <p>and the javascript I have this:</p> <pre><code> if (window.location.href = '?action=login') { window.document.getElementById('&lt;%=txtUserName.ClientID %&gt;').focus(); } else if (window.location.href = '?action=register') { window.document.getElementById('&lt;%=txtRegEmail.ClientID %&gt;').focus(); } </code></pre> <p><strong>EDITED</strong></p>
asp.net javascript
[9, 3]
3,041,596
3,041,597
Is it possible to use 2 versions of jQuery on the same page?
<p><em>NOTE: I know similar questions have already been asked <a href="http://stackoverflow.com/questions/613808/is-it-possible-to-load-multiple-different-version-of-jquery-on-the-same-page">here</a> and <a href="http://stackoverflow.com/questions/1117463/two-jquery-versions-on-the-same-page">here</a>, but I'm looking for additional clarification as to how to make this work or good reasons for avoiding it entirely.</em></p> <p>I'm adding functionality to an existing web site that is already using an older version of the jQuery library (1.1.3.1). I've been writing my added functionality against the newest version of the jQuery library (1.4.2). I've tested the website using only the newer version of jQuery and it breaks functionality, so now I'm looking at using both versions on the same page. How is this possible?</p> <p>What do I need to do in my code to specify that I'm using one version of jQuery instead of another? For example, I'll put <code>&lt;script&gt;</code> tags for both versions of jQuery in the header of my page, but what do I need to do so that I know for sure in my calling code that I'm calling one version of the library or another?</p> <p>Maybe something like this:</p> <pre><code>//Put some code here to specify a variable that will be using the newer //version of jquery: var $NEW = jQuery.theNewestVersion(); //Now when I use $NEW, I'll know it's the newest version and won't //conflict with the older version. $NEW('#personName').text('Ben'); //And when I use the original $ in code, or simply 'jquery', I'll know //it's the older version. $('#personName').doSomethingWithTheOlderVersion(); </code></pre> <p><em>UPDATE: After reading some of the answers, I'm starting to wonder if it's even a good idea to try to play this game at all...</em></p>
javascript jquery
[3, 5]
3,363,440
3,363,441
My Code wont replace the html strings properly?
<p>My current code:</p> <pre><code>a= a.replace("&amp;#039;", "'"); a = android.text.Html.fromHtml(a).toString(); </code></pre> <p>The issue is its still outputting this: </p> <pre><code>Magician&amp;#039;s </code></pre> <p>Though it is replacing most of the html it doesn't replace all of it. how can I fix this?</p>
java android
[1, 4]
1,157,012
1,157,013
Calling javascript from a code behind vs. calling a code behind from javascript
<p>I have a web application that will need to access code behind methods as well as javascript methods. For this particular implementation it doesn't really matter which order they are called in from a program flow perspective.</p> <p>I'm looking for insight into when it would be appropriate to use a code behind to call javascript and when it would be appropriate to call javascript from a code behind. Are there any ramifications of doing it one way or the other that I should be aware of before moving forward with an implementation?</p> <p>Is there a best practice way to do it or is it very specific to the actual implementation?</p>
c# asp.net javascript
[0, 9, 3]
291,366
291,367
How to access the client registry using JavaScript?
<p>Hai , How to set Key and Value in the client registry using javascript. I Just want to keep the user profiles in the registry. When a user visit the page from a particular system , automatically connect to the system preferred database.For that I want to keep the connection string in the windows registry. </p> <p>Please tell with code snippets , i am new in javascript. </p>
asp.net javascript
[9, 3]
3,250,768
3,250,769
image control unable to display image
<p>my code is:</p> <pre><code>string filename = FileUploader.PostedFile.FileName.Substring(fuImage.PostedFile.FileName.LastIndexOf("\\") + 1); if(fuImage.HasFile) { FileUploader.SaveAs(Server.MapPath("Modules/NewUserProfile/UserPic/" + filename)); imgUser.ImageUrl = Server.MapPath("Modules/NewUserProfile/UserPic/" + filename); } </code></pre> <p><code>imgUser</code> is id of <code>asp:Image</code> Control.Image is uploaded in desire folder but its not display image in image control.What i am doing wrong here? Is there any postback issue.Thanks.</p>
c# asp.net
[0, 9]
4,971,413
4,971,414
Dynamic jquery address using search button
<p>I'm trying to use <a href="http://www.asual.com/jquery/address/" rel="nofollow">http://www.asual.com/jquery/address/</a> for history management, this works absolutely fine when we work on "a" tags, but now I've search module which trigger when I click on a search button and I'm trying to include the search text in the address(and also the page number), so that when the user uses the backs button he/she can also see what search they have done previously. Any help will be greatly appreciated.</p> <p>Edited: Reference - <a href="http://www.asual.com/jquery/address/" rel="nofollow">http://www.asual.com/jquery/address/</a></p> <p>I'm building AJAX application, so all the modules are loaded using AJAX and to keep a track of the history I'm using: <a href="http://www.asual.com/jquery/address/" rel="nofollow">http://www.asual.com/jquery/address/</a>, till now all the links are "a" href's which I'm coding as Public </p> <p>Now, I'm working on the search page which has a search TextBox and a searchButton, so when the user enters in the text box and clicks on searchButton, the url has to be adjusted accordingly so when the user directly enters (or comes to that URL using BACK button), the search results should be displayed, this is similar to the "SEARCH MAIL" button in gmail, please note how the url is changing, here I'm also trying to achieve the same thing. Hope it is clear, thanks.</p> <p><br /></p> <p>Regards</p>
javascript jquery
[3, 5]
3,163,795
3,163,796
Good way to output javascript selectively depending on Application settings
<p>I am developing a site which includes several different javascript files and libraries. For optimization purposes I have implemented <a href="http://yuicompressor.codeplex.com" rel="nofollow">YUI Compressor for .Net</a></p> <p>This will minimize and combine my javascript files into one single file.</p> <p>Now I have put this up in a MSBuild script that automatically does the compression and minimization and outputs it to a file of my choosing. However, I still wish to keep the original javascript files in my development environment. My question is simply:</p> <p>Is there a good way to depending on the Debug setting for example choose which javascript to use? This to not have to change the MasterPage by hand each time I release the build.</p> <p>Allow me to illustrate.</p> <p>If I am running in Debug="true" I wish my MasterPage to include the following javascripts:</p> <pre><code>&lt;script type="text/javascript" src="first.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="second.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="third.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="fourth.js"&gt;&lt;/script&gt; </code></pre> <p>If I am running in Debug="false" I wish this to be outputted in the MasterPage:</p> <pre><code>&lt;script type="text/javascript" src="compressedAndMinimized.js"&gt;&lt;/script&gt; </code></pre> <p>Is there an elegant solution to this that I am missing here?</p>
c# asp.net javascript
[0, 9, 3]
751,781
751,782
Jquery hover action diappears when going to next div
<p>Im new to learning JQuery. Im doing a sample from JQuery Novice to Ninja and Im getting an error when I move my mouse over then next item. The #navigation_blob dissapears it could be a css problem for all I know but run the code tell me what you think I need to do. Im using the easing plugin</p> <pre><code>$(document).ready(function () { $('&lt;div id="navigation_blob"&gt;&lt;/div&gt;').css({ width: $('#navigation li:first a').width() + 10, height: $('#navigation li:first a').height() + 10 }).appendTo('#navigation'); $('#navigation a').hover(function () { $('#navigation_blob').animate( { width: $(this).width() + 10, left: $(this).position().left }, { duration: 'slow', easing: 'easeOutElastic', queue: false } ) }, function () { $('#navigation_blob') .stop(true) .animate( {width: 'hide'}, {duration: 'slow', easing: 'easeOutCirc', queue: false} ) .animate({ left: $('#navigation li:first a').position().left }, 'fast' ); }); }); &lt;style type="text/css"&gt; #navigation li { display:inline-block } #navigation_blob { background-color:Blue; position:absolute; float:left } &lt;/style&gt; &lt;ul id="navigation"&gt;&lt;li&gt;&lt;a href="#"&gt;Home&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#"&gt;About Us&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#"&gt;Buy!&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="#"&gt;Gift Ideas&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; </code></pre>
javascript jquery
[3, 5]
4,366,913
4,366,914
values entered in textbox should b displayed in label
<p>I am having a "TextBox" a "Label" and a "Button" in my aspx page. If I enter some values into the textbox, then that value should be displayed in the label...and again I enter some values in the same text box, that value should be displayed without disturbing the first value and so on.... </p>
c# asp.net
[0, 9]
4,588,513
4,588,514
Make an Image In Perspective
<p>As the title says I wonder how I can make my images to perspective view. Here's an image showing how they manage to do this in photoshop:</p> <p><a href="http://netlumination.com/blog/creating-perspective-and-a-mirror-image-in-photoshop" rel="nofollow">http://netlumination.com/blog/creating-perspective-and-a-mirror-image-in-photoshop</a></p> <p>Is it possible to do something like this in android?</p>
java android
[1, 4]
3,266,999
3,267,000
More efficient comparison of numbers
<p>I have an array which is part of a small JS game I am working on I need to check (as often as reasonable) that each of the elements in the array haven't left the "stage" or "playground", so I can remove them and save the script load</p> <p>I have coded the below and was wondering if anyone knew a faster/more efficient way to calculate this. This is run every 50ms (it deals with the movement).</p> <p>Where <code>bots[i][1]</code> is movement in X and <code>bots[i][2]</code> is movement in Y (mutually exclusive).</p> <pre><code>for (var i in bots) { var left = parseInt($("#" + i).css("left")); var top = parseInt($("#" + i).css("top")); var nextleft = left + bots[i][1]; var nexttop = top + bots[i][2]; if(bots[i][1]&gt;0&amp;&amp;nextleft&gt;=PLAYGROUND_WIDTH) { remove_bot(i); } else if(bots[i][1]&lt;0&amp;&amp;nextleft&lt;=-GRID_SIZE) { remove_bot(i); } else if(bots[i][2]&gt;0&amp;&amp;nexttop&gt;=PLAYGROUND_HEIGHT) { remove_bot(i); } else if(bots[i][2]&lt;0&amp;&amp;nexttop&lt;=-GRID_SIZE) { remove_bot(i); } else { //alert(nextleft + ":" + nexttop); $("#" + i).css("left", ""+(nextleft)+"px"); $("#" + i).css("top", ""+(nexttop)+"px"); } } </code></pre> <p>On a similar note the remove_bot(i); function is as below, is this correct (I can't splice as it changes all the ID's of the elements in the array.</p> <pre><code>function remove_bot(i) { $("#" + i).remove(); bots[i] = false; } </code></pre> <p>Many thanks for any advice given!</p>
javascript jquery
[3, 5]
1,759,953
1,759,954
How to filter out hazardous characters from input coming from xml file in ASp.Net 2.0 c#?
<p>I have an xml file with item containing URL with parameter. This parameter will be used in another page and accessed through <code>Request.QueryString()</code>. </p> <p>Doing AppScan, it is found out to be hazardous and need to filter hazardous characters from user input. How can I do this? Examples of the xml file item with the URL: </p> <pre><code>&lt;item Text="Test" navigate="Test.aspx?Param=TestList" /&gt; </code></pre> <p>or</p> <pre><code>&lt;item Text="Test1" navigate="Test1.aspx?Param=TestList;age=5;weight=9" /&gt; </code></pre> <p>Any help? </p>
c# asp.net
[0, 9]
359,774
359,775
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]
3,250,360
3,250,361
How to pass js code to string gracefully?
<p>There is my code </p> <pre><code>&lt;input type="radio" name="category" id="elementary" value="elementary" /&gt; 1 &lt;input type="radio" name="category" id="junior" value="junior" /&gt; 2 &lt;input type="radio" name="category" id="senior" value="senior" /&gt; 3 &lt;input type="radio" name="category" id="university" value="university" /&gt; 4 &lt;input type="radio" name="category" id="profession"/&gt; 5 &lt;div id='grade_select' class="clearfix"&gt; &lt;div id='elementary_grade' class="clearfix"&gt;&lt;/div&gt; &lt;div id='junior_grade' class="clearfix"&gt;&lt;/div&gt; &lt;div id='senior_grade' class="clearfix"&gt;&lt;/div&gt; &lt;div id='university_grade' class="clearfix"&gt;&lt;/div&gt; &lt;div id='profession_grade' class="clearfix"&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p>I want:</p> <p>When check one radio, need to hide all the div in grade_select, and then show the div which id include the current radio value</p> <p>There is my js code , I do not know how to going on </p> <pre><code> &lt;script type="text/javascript"&gt; $(document).ready(function($){ $( "input[name='category']" ).bind( "click", category_select) }); function category_select(){ $("div:[id=this.attr[id]]).show() } &lt;/script&gt; </code></pre> <p><strong>FYI:</strong> This question is a spinoff of <a href="http://stackoverflow.com/questions/10671865/how-to-change-muitl-divs-the-display-which-have-some-special-id">this other question</a>.</p>
javascript jquery
[3, 5]
140,511
140,512
Get elements using children length in Jquery
<p>I want to get <code>&lt;td&gt;</code> whose children length(size()) is 2 using Jquery. I am trying this but this returns me only size() &amp; not the <code>&lt;td&gt;'s</code>.</p> <pre><code>grid.find("tr").find("td").children().size(); </code></pre> <p>How can i do this?</p>
jquery asp.net
[5, 9]
5,283,152
5,283,153
Is it possible to load javascript file with http://localhost as the source?
<p>Is it possible to load a JavaScript file with <code>http://localhost</code> as the source?</p> <p>ex:</p> <p><code>&lt;script type="text/javascript" src="http://localhost:8081/signalr/hubs" language="javascript"&gt;&lt;/script&gt;</code></p> <p>I am using a script like this in my asp.net web application. It is working properly when running locally on my computer.</p> <p>Once I put the web application onto a live server and I access the page that has the above script, the GET for that script returns status "aborted". Is it possible to use this reference when accessing the website externally?</p> <p>Note*: <code>http://localhost:8081/signalr/hubs</code> has a javascript script called Hubs.js. Navigating to it from a browser on the server displays the script.</p>
javascript asp.net
[3, 9]
3,316,084
3,316,085
How to pass xml while requesting Rest web service
<p>I want to pass xml to rest web service with request. I am unable to get how I can do this.</p> <p>thanks in advance.</p>
java android
[1, 4]
4,939,588
4,939,589
Grid View Format By Row
<p>I'm wondering if it is possible to format a Grid View like the pattern below</p> <pre><code>Usual Grid View: Name Address Age Gender &lt;--- Fields Name Example Example Example Example &lt;--- Values What I want to look like "Fields" "Values" Name Example Address Example Age Example Gender Example </code></pre> <p>Any thought will be highly appreciated</p>
c# asp.net
[0, 9]
2,675,663
2,675,664
How to show the non-selected options in a select form, after a previous form is submitted
<p>I have a form where im asking for name, surname, phone cellphone and at the end user has to check one or more options in a checkbox and then clicks submit.</p> <p>After that in the "thank you page" i want to show the exact form but this time to show only the non-checked checkboxes. Reason for this is that i want to say "We highly recommend you check all the options for better results, you can do so by simply clicking the submit button below"</p> <p>And then below that i want to present the form as i said, but the remaining checkboxes (the oens that were not checked before) would be only the NON-checked options in the previous page. Makes sense?</p> <p>Ive tried hard with php if states and switches but still cant get the result i want, it seems i have to define "false statements" in a way im not cabable of doing it.</p> <p>Should i use php or jquery?</p> <p>Can anyone help me? Im kinda lost. Thanks a lot in advance</p>
php jquery
[2, 5]
182,526
182,527
Saving Application State in Android
<p>I am writing an app where I get all the data from the rest call and display all the data in a custom component list(based on Linear Layout) which is added to a <code>LinearLayout</code>. I write this code in <code>onCreate</code> of the activity.</p> <p>The problem is when I switch activity using <code>startActivity</code>, and come back to the calling activity (using <code>startActivity</code>) then <code>onCreate</code> is called again. I see <code>onPause</code>, <code>onStop</code> called when I call other activity.</p> <p>Is there any way that I can save the application's state?</p>
java android
[1, 4]
153,048
153,049
Adding Multiple inline javascript in single line
<p>I have 2 different links with inline js added.</p> <p>I would like to add both to a single inline onclick.</p> <p>Here are the two separate one:</p> <pre><code>&lt;a href="#" onclick=\'$("#id").toggle();\'&gt; &lt;a href="#" onclick="myvar = '1';"&gt; </code></pre> <p>And this is what I would like to do:</p> <pre><code>&lt;a href="#" onclick="$("#id").toggle();myvar = '1';"&gt; </code></pre> <p>How could I do this?</p>
javascript jquery
[3, 5]
3,192,439
3,192,440
Passing a string from javascript to server side code
<p>I want to get a string from javascript, pass it to server side code and then store it in a database. my problem is that i do not know which is the best way of passing a string from javascript to server side. </p> <p>From my research I found that many suggest using ajax xmlhttprequest but I haven't really found any good examples on how to actually use it when passing a string. if anyone knows any good sources that would be of great help. </p> <p>thanks</p>
c# javascript asp.net
[0, 3, 9]
4,102,440
4,102,441
trying to add hierarchy constraints to delegate()
<p>I've got a delegate statement that works like so:</p> <pre><code>$("body").delegate("tr[type='option']",'mouseenter',function(){ </code></pre> <p>The problem is that it's grabbing elements from tables I don't want. So I tried:</p> <pre><code>$("body").delegate("table[class='ms-MenuUI'] &gt; tr[type='option']",'mouseenter',function(){ </code></pre> <p>Which isn't working at all (though I'm not getting any console errors). Just wondering how I can tighten this up so it's only grabbing table rows from the specific table I want.</p> <p>NOTE: the table does not exist in the DOM on page load, and is dynamically created/destroyed after the doc is ready, thus the need for delegate to begin with.</p> <p>EDIT: As per my comment below, I'm using [] because the attribute of the parent is variable, and it's my understanding that they should work interchangeably with the attribute short-hand (i.e. '.'). A sample of the dynamic code would be:</p> <pre><code>$('body').delegate('table[' + parentAttribType + "='" + parentAttribValue + "'] &gt; tr[" + rowAttrbType + "='" + rowAttribValue + "']"), 'mouseenter', function(){ </code></pre> <p>Thanks!</p>
javascript jquery
[3, 5]
4,546,400
4,546,401
Loading usercontrol on runtime and reloading the page
<p>On my page I have a placeholder where I load a usercontrol when I select an item in dropdownlist. </p> <pre><code>protected void ddlLoadCtr_SelectedIndexChanged(object sender, EventArgs e) { Control userControl = LoadControl("../AleSettings1.ascx"); plchldSettingsControl.Controls.Add(userControl); } </code></pre> <p>If I press F5 (IE) after user control was rendered, I get IE's warning window that IE needs to resend the information....<br> How can I prevent it and why does it happen?</p> <p><strong>UPDATE:</strong></p> <p>Maybe there is another approach? I want to load specific control (with it's markup) when user selects it from the dropdownlist.<br> if a postback is made the control shouldn't disappear(only if another control was selected from the dropdownlist) </p> <p>Everything is inside update panel!</p>
c# asp.net
[0, 9]
1,776,109
1,776,110
Update or Insert a new value
<p>I have the following SQL command in asp.net:</p> <pre><code>cmd = connection.CreateCommand(); cmd.CommandText = "INSERT INTO userscore (username, score)VALUES(@username, @score)"; cmd.Parameters.AddWithValue("@username", username); cmd.Parameters.AddWithValue("@score", userscore); cmd.ExecuteNonQuery(); </code></pre> <p>This command works but it stores two values in the my sql database every button click. It gets the score value from the textbox, but when an username + a score is in the database already, I want to update the value. Can someone help me with a query to get this done?</p> <p>To clarify my question: I want to store the new score even when it's lower then the current score, and the username is unique in the table.</p>
c# asp.net
[0, 9]
3,319,972
3,319,973
Correct number is not being displayed in the textbox
<p>Problem:</p> <p>In the "Number of Answers" textbox, it should display the number 1, but it doesn't, it displays the number 2 and the reason it is displaying this number is that before the buttons changed, you selected 2 letter buttons, so it displays 2 in the textbox because you previously chose 2 letter buttons.</p> <p>Now this is happening because of this code: </p> <pre><code>$('.answertxt', context).val(context.find('.answerBtnsOn').length &gt; 0 ? context.find('.answerBtnsOn').length : '');, </code></pre> <p>in the <code>$('.gridBtns').on('click', function()</code> but I do need this code. </p> <p>The reason I need this code is because lets say there is 7 letter buttons "A-G" and you turn on all the letter buttons, the textbox would display number "7", but if I change my mind and I want to only display 5 letter buttons "A-E", then the textbox would change from "7" to "5" as now only 5 buttons are turned on. That is why I need this code.</p> <p>So my question is that if the user has clicked on the "Add" button, how can I get the number from the "Number of Answers" column within the row added be displayed in the textbox?</p> <p>Below is the code I have where it is suppose to display the number within the textbox when the "Add" button is clicked on but it is over written because of the <code>"$('#btn'+gridValues).trigger('click');"</code> and in that code is the </p> <pre><code>$('.answertxt', context).val(context.find('.answerBtnsOn').length &gt; 0 ? context.find('.answerBtnsOn').length : '');, </code></pre> <p>in the <code>$('.gridBtns').on('click', function()</code></p> <pre><code>function addwindow(numberAnswer, gridValues, btn) { $('#mainNumberAnswerTxt').val(numberAnswer); $('#btn'+gridValues).trigger('click'); } </code></pre>
javascript jquery
[3, 5]
4,255,313
4,255,314
Suggestion to improve the script
<p>In the below script I am trying to highlight all the words in a sentence </p> <pre><code>function SearchQueue(text) { if(text !== null) { text = text.replace(/“/g, "\""); text = text.replace(/”/g, "\""); text = text.replace(/’/g, "\'"); text = text.replace(/‘/g, "\'"); text = text.replace(/–/g, "\-"); text = text.replace(/ +(?= )/g,''); $.trim(text); text = text.replace(/\d\.\s+|[a-z]\)\s+|•\s+|[A-Z]\.\s+|[IVX]+\.\s+/g, ""); text = text.replace(/([0-9A-Z]+[.)]|•)\s+/gi, ""); text = text.replace(/(\r\n|\n|\r)/gm," "); } var words = text.split(' '); for(var i=0;i&lt;words.length;i++) $('*').highlight(''+words[i]+''); // Will highlight the script with background color } </code></pre> <p>But this is making my page "unresponsive". Please suggest me to improve the script...</p>
javascript jquery
[3, 5]
5,403,682
5,403,683
Server.MapPath with ~
<p>I am trying to get the path. Not sure if it should be:</p> <pre><code> string driveLetter = Server.MapPath("~/Docs/"); </code></pre> <p>or</p> <pre><code> string driveLetter = Server.MapPath("~/Docs"); </code></pre>
c# asp.net
[0, 9]
1,711,400
1,711,401
How do I make an image that is currently hidden, become visible upon validation passing in asp.net
<p>I have a simple web form in asp.net that has some validation on the form fields. I also have an image whose visibility is set to false. In my validation if statement I want code that will make that image visible if the validation has passed. Below is what I have but the image is not displaying. Thanks!</p> <pre><code>if (!Page.IsValid) return; //Order is valid. Process it. lblOrderDetails.Text = "&lt;h1&gt;Success!&lt;/h1&gt;" + "&lt;b&gt;Email: &lt;/b&gt; " + tbEmail.Text + "&lt;br /&gt;" + "&lt;b&gt;Model: &lt;/b&gt; " + dlModel.SelectedItem.Text + "&lt;br /&gt;" + "&lt;b&gt;Discounts: &lt;/b&gt; "; imgSnowboard.Visible = true; &lt;asp:Image Visible="false" runat="server" ImageUrl="~/SnowBoard.jpg" ID="imgSnowboard"/&gt; </code></pre>
c# asp.net
[0, 9]