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
698,464
698,465
Form framework for dynaimcally adding, altering fields
<p>I have several forms on my website in which fields are dynamically created or altered based on what is altered in previous fields? Is there a good framework for doing this easily?</p>
php javascript
[2, 3]
5,450,937
5,450,938
jquery pop up(php inside) when browser idle
<p>good day everyone, i have a little question about jquery, is it possible if we want to make jquery pop up which it contains a php and mysql data when the browser idle(about 30 min) :D</p> <p>Someone can give me an example or any tutorial, will help? thx</p>
php jquery
[2, 5]
5,752,298
5,752,299
Dynamically created button not firing Click event
<p>I am creating dynamic controls, in that one control is a button. i used the following code to add the button control.</p> <pre><code> Button btnContinue = new Button(); btnContinue.Attributes.Add("class", "button"); btnContinue.ID = "btnContinue"; btnContinue.Text = "Continue"; btnContinue.CausesValidation = false; btnContinue.Click += new EventHandler(btnContinue_Click); lineAdd.Controls.Add(btnContinue); </code></pre> <p>And the button click event as below.</p> <pre><code>protected void btnContinue_Click(object sender, EventArgs e) { ... } </code></pre> <p>This event is not firing. Any idea why this is not firing the event. Please correct me if i am wrong.</p> <p>Thanks in Advance.</p>
c# asp.net
[0, 9]
5,323,263
5,323,264
dynamically adding validators
<p>In my case I would like to dynamically add validators to my control based on given logic. For each control I first check something in my DB and if it goes aout that field is required I would like to add requiredField to that control. I firt iterate through each control and if its required I add attribute required="true".</p> <p>I added this code but it doens work I mean nothing happens, none validation is being made.</p> <pre><code>if(gc.Attributes["controlid"] != null) { RequiredFieldValidator validator = new RequiredFieldValidator(); validator.ControlToValidate = gc.Attributes["controlid"]; validator.ErrorMessage = gc.Attributes["errormessage"]; this.Controls.Add(validator); } </code></pre> <p>Thanks for any suggestions.</p>
c# asp.net
[0, 9]
4,294,147
4,294,148
Javascript function calling question
<p>Is it possible to do what I want? the <code>changeEl()</code> function is also in <code>fadeGall()</code></p> <pre><code> function initOpen(){ $('ul.piple-holder &gt; li &gt; a, ul.work-holder &gt; li &gt; a').each(function(){ var _box = $(this); _box.click(function(){ //SOME CODE HERE TO RUN changeEl(0); on each _hold //element from fadeGall() }); }); } function fadeGall(){ var _hold = $('div.work-info'); _hold.each(function(){ var _hold = $(this); function changeEl(_ind){ return; } }); } </code></pre>
javascript jquery
[3, 5]
1,894,278
1,894,279
Sending mail periodically in ASP.net
<p>I'm trying to send confirmation mails to users periodically in ASP.NET. </p> <p>To do this I polulate a queue with mails and check it every 30 seconds. Any confirmation emails in the queue at this time are sent and then cleared from the queue. </p> <p>Does anyone know how to do this? </p> <p>Here is my sending mail code</p> <pre><code>public static bool SendMail(string AdminMail,string AdminPassword,string subject,string toAddress, string content,DateTime SendTime) { toAddressListProperty.Enqueue(toAddress); if(date==null) { date = DateTime.Now.Second; } if (date-SendTime.Second &gt; 120) { var message = new MailMessage { From = new MailAddress(AdminMail) }; foreach (var toAddressl in toAddressListProperty) { message.To.Add(new MailAddress(toAddressl)); } message.Subject = subject; message.Body = content; message.IsBodyHtml = true; var smtp = new SmtpClient { Credentials = new System.Net.NetworkCredential(AdminMail, AdminPassword), Port = 587, Host = "smtp.gmail.com", EnableSsl = true }; smtp.Send(message); //date = SendTime; return true; } return false; } </code></pre>
c# asp.net
[0, 9]
923,377
923,378
Localization of javascripts and jquery alerts
<p>Is it possible to localize the javascript and jquery in asp.net (.net 4)?</p> <p>Is there any proper examples with c#?</p>
c# javascript jquery asp.net
[0, 3, 5, 9]
619,759
619,760
Is this the correct way to set an id for an element that doesn't have an id yet in jQuery?
<pre><code>$("a[href*='http://www.google.com']").attr('id','newId'); </code></pre> <p>Can only reference it by <code>href</code>.</p>
javascript jquery
[3, 5]
5,623,260
5,623,261
Giving up control: machine code generation vs memory layout?
<p>This may be a bit off topic of "right answer, not discussion."</p> <p>However, I am trying to debug my thought process, so maybe someone can help me:</p> <p>I use compilers all the time, and the fact that I'm giving up control over machine code generation (the layout of my caches, and the flow of electrons) does not bother me.</p> <p>However, giving up control of memory layout (being able to place stuff in memory) and memory management (garbage collection) still bothers me these days.</p> <p>Have others dealt with this? If so, how did you get past it? (In particular, how I often feel "safer" in C++ than in Java.)</p> <p>Thanks!</p>
java c++
[1, 6]
165,402
165,403
passing javascript value to another page
<p>I am trying to passing javascript variable value to another page and retrieve here into a php variable</p> <p>Using function i made a pop up to appear and store it to a java script variable so now how do i pass it another page and i do have some text box values but i get this ,i use action and give page name in it.I need both text box value and prompt value in another page.</p>
php javascript
[2, 3]
5,165,186
5,165,187
Getting cookie data from get PHPSESSID in Java
<p>Working on a Java app that sends POST data to a forum to post data. Works almost great. Seems if I don't have PHPSESSID cookie set I get a 403 but when I get cookies, its not one of those returned to me.</p> <p>Any idea how I can get this cookie or is the only solution to disable?</p>
java php
[1, 2]
3,374,136
3,374,137
Dropdown list
<p>I want people to choose from a dropdown list,and their choice takes them to a page they have chosen.</p>
c# asp.net
[0, 9]
460,830
460,831
Getting a radio button ID with jQuery
<pre><code>$(function () { $("#MyInputBox").keyup(function () { var nextChk = $(this).next(":radio:checked").attr('id')); alert(nextChk); }); }); </code></pre> <p>What is the correct way to say "Get the ID of the next checkbox which is checked" Am I even close?</p>
javascript jquery
[3, 5]
543,730
543,731
how to resize iframe height on browser resize?
<p>I am trying to resize the iframe on window resize as well as the content within the iframe</p> <p>Current the script I have seta the height on load only.</p> <p>Can any one help??</p> <p>Eaxmple attached</p> <p><a href="http://jsfiddle.net/zidski/GRRWj/7/" rel="nofollow">http://jsfiddle.net/zidski/GRRWj/7/</a></p>
javascript jquery
[3, 5]
1,532,866
1,532,867
Add new row to table
<pre><code> HtmlTable baseCalendar = new HtmlTable(); HtmlTableRow calendarRow = new HtmlTableRow(); HtmlTableCell calendarCell = new HtmlTableCell(); for (int i = 1; i &lt; 7; i++) { calendarRow = new HtmlTableRow(); for (int k = 0; k &lt; 7; k++) { calendarCell = new HtmlTableCell(); calendarRow.Cells.Add(calendarCell); } baseCalendar.Rows.Add(calendarRow); } //in this place how can add new row to first row of `baseCalendar` </code></pre> <p>for example :</p> <pre><code> baseCalendar=" &lt;table&gt; &lt;tr id='row1'&gt; &lt;td&gt;&lt;/td&gt; &lt;td&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt;" </code></pre> <p>how can add new row befor <code>row1</code></p>
c# asp.net
[0, 9]
3,807,167
3,807,168
Javascript stopped working
<p>For some reason, the scripts that I have set up on my wordpress install stopped working yesterday afternoon. I had been editing things, but I'm not sure what I could have done that caused it to stop.</p> <p>Is there any way that I can error check why it's not working, or any common reasons why it might not be?</p> <p>The site is up at</p> <p><a href="http://www.delsilencio.net/staging/wordpress/" rel="nofollow">http://www.delsilencio.net/staging/wordpress/</a></p>
jquery javascript
[5, 3]
1,478,150
1,478,151
Javascript undefined attribute
<p>I'm new to Javascript and I got this:</p> <p>I have a <code>GridView</code> with the following event:</p> <pre><code>protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { foreach (TableCell c in e.Row.Cells) { c.Attributes.Add("full","false"); } } </code></pre> <p>And in my javascript I have an <code>onClick</code> event for every cell:</p> <pre><code>if(source.full="false") { ... source.full="true"; } else { ... source.full="false"; } </code></pre> <p>Why is it that <code>source.full</code> is always <code>undefined</code> on the first click?</p>
c# javascript asp.net
[0, 3, 9]
571,125
571,126
2 javascripts plugin not working together
<p>I tried to implement 2 plugins in a page and when i introduce the 2nd one... the 1st plugins stops working .. can you please help me in this.. he is the page i am trying to build..</p> <p><a href="http://www.abc.com/home21" rel="nofollow">http://www.abc.com/home21</a></p> <p>and here are the 2 plugins i am trying to use.</p> <p><a href="http://www.catswhocode.com/blog/how-to-integrate-a-slideshow-in-your-wordpress-theme" rel="nofollow">http://www.catswhocode.com/blog/how-to-integrate-a-slideshow-in-your-wordpress-theme</a></p> <p><a href="http://www.fyneworks.com/jquery/star-rating/" rel="nofollow">http://www.fyneworks.com/jquery/star-rating/</a></p> <p>here is my code.. The rating script was working from beginning. i tried to add this slideshow in this page like</p> <pre><code>&lt;link rel="stylesheet" href="testing/t1/css/layout.css" type="text/css" media="screen" charset="utf-8" /&gt; &lt;link rel="stylesheet" href="testing/t1/css/jd.gallery.css" type="text/css" media="screen" charset="utf-8" /&gt; &lt;script src="testing/t1/scripts/mootools.v1.11.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="testing/t1/scripts/jd.gallery.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="testing/t1/scripts/jd.gallery.transitions.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; var newj = jQuery.noConflict(); function startGallery() { var myGallery = new gallery(newj('myGallery'), { timed: true, showArrows: false, embedLinks: false, showCarousel: true, defaultTransition: "continuoushorizontal" }); } window.onDomReady(startGallery); &lt;/script&gt; </code></pre> <p>please help me how to solve this problem</p>
javascript jquery
[3, 5]
3,792,661
3,792,662
Is there a way to avoid size limit when using getResources().openRawResource()
<p>I am trying to load an XML file from res/raw folder in my Android project when the app first runs. I do this with this line:</p> <pre><code>InputStream xmlStream = getResources().openRawResource(R.raw.xmlfile); </code></pre> <p>I then want to use a SAX Parser to get data from the XML file. When doing this LogCat shows the following error:</p> <pre><code>Data exceeds UNCOMPRESS_DATA_MAX (1290892 vs 1048576) </code></pre> <p>Is there anyway around this 1MB limit?</p> <p>After a few Google searches, I found people who have split their files into 1MB chunks, but these weren't XML files so I am not sure how I would rejoin them before making the InputSource for my SAX Parser.</p> <p>My file is not created by me, so I can't really edit it (although I may have to) and my code works if I retrieve it from Internet. Its around 1,300KB in size, so I want to not have to download it each time app run</p>
java android
[1, 4]
1,150,634
1,150,635
Select control using jQuery - using value of hiddenfield
<p>I have a hidden field, which has the following markup:</p> <pre><code>&lt;input type="hidden" name="ctl00$ContentPlaceHolder1$LinksOverview1$ProductView$ctrl1$ctl01$ctl00$DescriptionOfLink$QuestionDivInfo" id="ContentPlaceHolder1_LinksOverview1_ProductView_ctrl1_ctl00_3_DescriptionOfLink_3_QuestionDivInfo_3" value="ContentPlaceHolder1_LinksOverview1_ProductView_ctrl1_ctl00_3_questionMark_3" /&gt; </code></pre> <p>The value of my hidden field, is the same as the ID of a span i have:</p> <pre><code>&lt;span id="ContentPlaceHolder1_LinksOverview1_ProductView_ctrl1_ctl00_3_questionMark_3" class="questionMarkLayout"&gt;(?)&lt;/span&gt; </code></pre> <p>I dont know the ID of my span before the code is rendered, but I can access the value of my hidden field.</p> <p>Using jQuery, I want to:</p> <ul> <li>Grap the control, with the ID of the value of my hiddenfield</li> </ul> <p>So far I've tried:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { alert('&lt;%#QuestionDivInfo.ClientID %&gt;'); $('&lt;%#QuestionDivInfo.ClientID %&gt;').val().mouseover(function (e) { $('&lt;%#HintDiv.ClientID %&gt;').show(); }); $('&lt;%#QuestionDivInfo.ClientID %&gt;').val().mouseleave(function (e) { $('&lt;%#HintDiv.ClientID %&gt;').hide(); }); }); &lt;/script&gt; </code></pre> <p>But it doesn't work.</p> <p>Any hints? :)</p>
jquery asp.net
[5, 9]
5,889,177
5,889,178
retrieve all the hyperlinks from html file using jquery or javascript
<p>I need to retrieve all the hyperlinks present in current html page using jquery. How can i use regular expressions to do that? Also can i use collections in javascript to store all the hrefs in the list?</p>
javascript jquery
[3, 5]
690,558
690,559
JQuery On Click with data attribute
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2487747/selecting-element-by-data-attribute">Selecting element by data attribute</a> </p> </blockquote> <p>I'm trying to listen to when an element with a certain data attribute is clicked but I can't seem to get the on click working and I'm sure its something easy on my part that I'm missing. I have</p> <pre><code>&lt;a href="/home" data-spinner="true" /&gt; </code></pre> <pre><code>$.data('record').click(function() { //Do Action }); </code></pre> <p>I have that with variations. My question is, how can I use an data attribute with on click?</p>
javascript jquery
[3, 5]
1,560,225
1,560,226
Can you create a .java file in a c++ program?
<p>Is it possible for me to create a .java file using c++? If so, how?</p>
java c++
[1, 6]
5,925,056
5,925,057
how to call a js function from loaded jquery
<p>the function is in the page loading the ajax but i'm trying to call the function</p> <p>codes:</p> <p>[ajax] </p> <pre><code>$.ajax({ type: "POST", url: "loginpersonal.asp", data: "id=&lt;%=request("id")%&gt;", beforeSend: function() { $("#personaltab").hide(); }, success: function(msg){ $("#personaltab").empty().append(msg); }, complete: function() { $("#personaltab").slideDown(); }, error: function() { $("#personaltab").append("error").slideDown(); } }); </code></pre> <p>[the js function]</p> <pre><code>function GetCount(t){ if(t&gt;0) { total = t } else { total -=1; } amount=total; if(amount &lt; 0){ startpersonalbid(); } else{ days=0;hours=0;mins=0;secs=0;out=""; days=Math.floor(amount/86400);//days amount=amount%86400; hours=Math.floor(amount/3600);//hours amount=amount%3600; mins=Math.floor(amount/60);//minutes amount=amount%60; secs=Math.floor(amount);//seconds if(days != 0){out += days +":";} if(days != 0 || hours != 0){out += hours +":";} if(days != 0 || hours != 0 || mins != 0){out += ((mins&gt;=10)?mins:"0"+mins) +":";} out += ((secs&gt;=10)?secs:"0"+secs) ; document.getElementById('countbox').innerHTML=out; setTimeout("GetCount()", 1000); } } window.onload=function(){ GetCount(&lt;%= DateDiff("s", Now,privatesellstartdate&amp;" "&amp;privatesellstarttime ) %&gt;); </code></pre> <p>so at the end of the loginpersonal.asp from the ajax... if it does what it suppose to do... i'm trying to call the function GetCount() again.</p>
jquery javascript
[5, 3]
3,881,951
3,881,952
Variable Undefined in Anonymous Function
<pre><code>function updateServerList() { var i; for (i=0; i &lt; servers.length; i++) { var server = servers[i]; var ip = server['serverIp'] var html = constructServer(i); var divId = '#server' + ip.replace(new RegExp("\\.", "mg"), "-"); var visible = $(divId).find(".server_body").is(":visible"); var div = $(divId); div.html(html); // Set div class. var prevState = div.attr('class').substring(7) if (prevState != server['state']) { if (server['state'] == 'ok') { console.debug(server); div.slideUp('fast', function(server) { $(this).removeClass(); $(this).addClass('server_ok'); var id = ipToId[server['serverIp']]; console.debug(id); if (id == 0) { adjacentIp = servers[1]['serverIp']; adjacentDivId = '#server' + adjacentIp.replace(new RegExp('\\.', 'g'), '-'); $(adjacentDivId).before(this); } }).delay(1000); div.slideDown(); } } } </code></pre> <p><code>console.debug</code> shows <code>server</code> as being defined, but inside the anonymous function, <code>server</code> is not defined. What am I going wrong?</p>
javascript jquery
[3, 5]
866,977
866,978
Multiple instances of a view object within an android activity
<p>I have two custom view objects that are created within an activity like so.</p> <pre><code>public class Statistics extends Activity { GraphWindow graph1; GraphWindow graph2; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.statistics); graph1 = (GraphWindow) findViewById(R.id.graph1); graph2 = (GraphWindow) findViewById(R.id.graph2); ... } </code></pre> <p>However they seem to be acting as one instance, so a public method to graph1 will also be executed on graph 2. Do I need to initiate each graph view as a new instance somehow? Where would I do this? </p> <p><strong>EDIT</strong></p> <p>Here is the (condensed) GraphWindow Class:</p> <pre><code>public class GraphWindow extends View { //draw data public ArrayList&lt;DataPoint&gt; data = new ArrayList&lt;DataPoint&gt;(); //set height public int graphHeight = 0; public int indexStart = 0; public int indexFinish = 0; public boolean isTouched = false; public boolean isDraggable = false; public GraphWindow(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } public GraphWindow(Context context, AttributeSet attrs) { super(context, attrs); } public GraphWindow(Context context) { super(context); } public void setGraphHeight(int graphHeight) { this.graphHeight = graphHeight; } public void isDraggable(boolean isDraggable) { this.isDraggable = isDraggable; } public void panBox(MotionEvent event) { rectX = (int)event.getX(); rectW = this.getWidth()/5 + rectX; this.postInvalidate(); } public void clearData() { this.data.clear(); } @Override public void onDraw(Canvas canvas) { super.onDraw(canvas); ... } @Override public void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { ... } } </code></pre> <p>In particular the clear data method will operate on both graph1 and graph2.</p>
java android
[1, 4]
202,486
202,487
i want to attach a click evet for the selected items and show tooltip on mouse over in autocomplete control in jquery
<pre><code> $(document).ready(function(){ $("#select3").fcbkcomplete({ json_url: "data.txt", addontab: true, maxitems: 10, input_min_size: 0, height: 10, cache: true, newel: true, select_all_text: "select", }); }); </code></pre> <p>i am generating this above code in code behind. i want to attach a click evet for the selected items and show tooltip on mouse over in autocomplete control in jquery</p> <p>Thanks in advance</p>
javascript jquery asp.net
[3, 5, 9]
4,797,545
4,797,546
Seperate HTTP connection results (PHP echo)
<p>In my Android application I make a HTTP POST connection:</p> <pre><code>serverresponse = CustomHttpClient.executeHttpPost(url, postParameters); </code></pre> <p>All working fine. The <code>url</code> is pointing to a php page on my server. It echos an array of image urls in JSON format like this:</p> <p><code>[".\/pictures\/q\/thumbnails\/28052011172.jpg",".\/pictures\/q\/thumbnails\/picca1.jpg",".\/pictures\/q\/thumbnails\/lockscreen_006.jpg"]</code></p> <p>What I want to do is also echo the size of directory. That works fine too, but that puts it right after the JSON array, like so:</p> <pre><code>echo (json_encode($files)); echo (filesize_r($path)); </code></pre> <p><code>[".\/pictures\/q\/thumbnails\/28052011172.jpg",".\/pictures\/q\/thumbnails\/picca1.jpg",".\/pictures\/q\/thumbnails\/lockscreen_006.jpg"]4223566</code></p> <p>4223566 is the number of bytes. In my application I want to split these two values into different strings so I can use them.</p> <p>In short, I want to seperate these two php echos. I don't want to make two seperate HTTP connections for both of them.</p> <p>Sorry if my question isn't clear enough, I sometimes have a hard time explaining stuff in English.</p>
java php android
[1, 2, 4]
5,885,896
5,885,897
Magnify search box similar to that on Apple.com
<p>If you go to <a href="http://apple.com" rel="nofollow">http://apple.com</a> and click in the search box, you'll notice it grows/magnifies <code>onfocus</code>, and <code>onblur</code> it collapses back to it's original state.</p> <p>I'm wondering if there's a jquery plugin or similar to do this job easily. </p> <p>I don't want to use the JS that's on the Apple website since it's not fully cross browser. I also don't have time to roll my own. If there's nothing prebuilt, that's ok, but if anyone knows of anything pre-made, I'd be very grateful. </p>
javascript jquery
[3, 5]
3,401,804
3,401,805
base64 encode audio file and send as a String then decode the String
<p>I have been stuck on this issue for a few hours now trying to get it working. Basically what I am trying to do is the following. Base64 encode an audio file picked up from an sdcard on an Android device, Base64 encode it, convert it into a String and then decode the String using Base64 again and save the file back to sdcard. It all sounds fairly simple and works great when doing it using a text file. For example if I create a simple text file, call it dave.text and inject some text it in say "Hello Dave" or something similar it works great, but fails when I try doing the same with a binary file, audio in this example. Here's the code that I am using.</p> <pre><code>File file = new File(Environment.getExternalStorageDirectory() + "/hello-4.wav"); byte[] FileBytes = FileUtils.readFileToByteArray(file); byte[] encodedBytes = Base64.encode(FileBytes, 0); String encodedString = new String(encodedBytes); Utilities.log("~~~~~~~~ Encoded: ", new String(encodedString)); byte[] decodedBytes = Base64.decode(encodedString, 0); String decodedString = new String(decodedBytes); Utilities.log("~~~~~~~~ Decoded: ", new String(decodedString)); try { File file2 = new File(Environment.getExternalStorageDirectory() + "/hello-5.wav"); FileOutputStream os = new FileOutputStream(file2, true); os.write(decodedString.getBytes()); os.flush(); os.close(); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } </code></pre> <p>At this point if I try to save the file, it becomes corrupted. The audio file hello-5.wav is larger in size then the original and it doesn't play.</p> <p>Any ideas what I am doing wrong here? If I try to save decodedBytes using os.write(decodedBytes) it works but not when converted to a String and getBytes() is used.</p> <p>Any ideas? Thank You!</p>
java android
[1, 4]
4,986,877
4,986,878
C# Populate Radiobuttons in a TreeView on PageLoad with a Database Returned Value
<p>I am using a TreeView control, and I would like to be able to use radiobuttons instead of checkboxes. I am currently creating the radiobuttons using the following code: </p> <pre><code>e.Node.ChildNodes.Add(new TreeNode(String.Format("&lt;input type='radio' value='{0}' name='rblMain' /&gt; {1}", value, name), value)); </code></pre> <p>Now my question is how can I repopulate the node with the value that I am returned from the database to the correct node and have it be selected?</p> <p>Thanks, Andrew</p>
c# asp.net
[0, 9]
1,897,751
1,897,752
How do I supply values to an referenced assembly without calling a method it explicitly?
<p>Currently I have a static class that I use as my logging module. I’ve added the class to my visual studio solution. Within the class I’ve specified the name and location of the log file to use. Which lets me do stuff like this – which I like and want.</p> <pre><code>Logger.Information(“Page_Load”,”controls loaded correctly”); </code></pre> <p>I’d like to refactor the code and move the logging functionality into a separately compiled assembly, if I did this I would then need to pass in the log file name and location to save the files too. </p> <p>However I don’t want to have to supply this information every time I call the ‘Logging’ method, this would be <strong>bad...</strong></p> <pre><code>Logger.Informtaion(“Page_Load”,”controls loaded correctly”,”logfile.txt”,”c:\temp”); </code></pre> <p>Is there any way I can supply this information without having to specify it within each page or via the method call.</p>
c# asp.net
[0, 9]
4,756,810
4,756,811
asp.net new page on button click
<p>Trying to display a new page, in a new window when the user clicks on a button. Trying to test it out with this but no luck so far:</p> <pre><code>Label1.Text = "&lt;form&gt;&lt;input type=button name=print value='Print View' onClick='javascript:window.open('http://mylink','mywindow')'&gt;&lt;/form&gt;"; </code></pre> <p>I think it might be a formatting issue, but just can't see it. For example this works just fine:</p> <pre><code>&lt;input type=button name=close value='Close' onClick='javascript:parent.jQuery.fancybox.close()'&gt; </code></pre>
c# asp.net
[0, 9]
3,505,516
3,505,517
Microsoft JScript runtime error: 'done' is undefined how to solve this?
<p>i am getting an error while login to web page in my project which is build in C# lang asp.net and i am running this using master page plz help me to solve this.</p> <pre><code>error: Microsoft JScript runtime error: 'done' is undefined </code></pre>
c# asp.net
[0, 9]
4,854,868
4,854,869
jQuery: How can I detect if the html has changed within a given element?
<p>In javascript, possibly using jQuery, how can I detect if the html content of a given element has changed?</p> <p>I'd like to be able to do somthing like:</p> <pre><code>$('#myDiv').change(function(){ // do some stuff }); </code></pre> <p>I am basically trying to detect if given elements are being added to the div or if the inner html of given elements (such as labels) has changed and then hide or show the div depending on the content. </p> <p><strong>Any alternative idea about how to achieve smt like this is also appreciated</strong>.</p> <p>I am hoping I won't have to revert to some obscure plugin to do this!</p> <p>NOTE: this needs to work at least in IE8!</p>
javascript jquery
[3, 5]
580,693
580,694
Create opening application
<p>I would like to display an image at the opening of my application Android (Java), is like a toast in full screen only.</p> <p>That is, when you open the application and an image appears and disappears after you start the program.</p> <p>What better way to do this?</p>
java android
[1, 4]
2,137,843
2,137,844
Why this type of array wrapping does not work in jQuery?
<p>Consider this:</p> <pre><code>var i=$('&lt;img src="/path/to/imgI.png"/&gt;'); var j=$('&lt;img src="/path/to/imgJ.png"/&gt;'); $([i,j]).css('cursor','hand'); </code></pre> <p>The cursor is not changed however and I don't know why..</p> <p>When I do it separately, it works.</p> <p>Thanks.</p>
javascript jquery
[3, 5]
3,851,428
3,851,429
Learning C++/Java coming from python
<p>As far as my programming career went, I started out with Python, then went into Javascript, now I'm into PHP. I really want to learn a compiled language like c++ and Java. I don't exactly know how to start, especially since I'm currently looking into going into CS or CE in University, and my school don't offer anything that will let me learn any programming language at all, beside actionscript.</p> <p>I want to find a book, though I can't find one where it explains new concepts in C++ and Java that's not present in python, and skips the basics. I could either find books that's really advanced, or very basic.</p> <p>Lastly, I know the best way to learn a language is to build something with it, or enroll in an open source project. I also know that trying to join a project is very difficult, as you need to familiarize the code that other people have written, which may or may not be in your style. What are some of your recommendations?</p>
java c++ python
[1, 6, 7]
1,267,663
1,267,664
js, log object is different to log 'string' + obj
<p>I'm logging a jQuery object, which assigns to </p> <pre><code>eg: $obj = &lt;div&gt;&lt;/div&gt; </code></pre> <p>if I</p> <pre><code> log $obj </code></pre> <p>I get ''</p> <pre><code> &lt;div&gt;&lt;/div&gt; </code></pre> <p>, which is what I need. But when I</p> <pre><code> Log 'some string' + $obj </code></pre> <p>I get this</p> <pre><code> [ object, object] </code></pre> <p>which is not what I want. How do I get the normal log</p>
javascript jquery
[3, 5]
2,392,462
2,392,463
get value based on index dropdown
<p>I need to select a value from dropdown based on index. It is a super easy question. cannot find the property:</p> <p>I though doing something like: </p> <pre><code>dll.Items[index] </code></pre> <p>But still do not know how to get value for this index.</p>
c# asp.net
[0, 9]
1,486,486
1,486,487
vector.push_back equivalent in Java
<p>In <code>C++</code>, I don't have to know the size of how much content I'm going to stuff into a int vector while declaring it, i.e.</p> <pre><code>vector&lt;int&gt; x; x.push_back(1); ... ... ... x.push_back(10); </code></pre> <p>What would be an equivalent data structure for doing the same in <code>Java</code>?</p>
java c++
[1, 6]
2,228,114
2,228,115
How to pass textbox value to JavaScript?
<p>How to pass two textbox values to a javascript function on a button click event.I have tried it like this but it is not working.here is my code</p> <pre><code>&lt;asp:LinkButton ID="lnkBTNSubmit" runat="server" CssClass="buttonlink" OnClientClick="checkDateRange(GetTextBoxValue('&lt;%= txtATrendStartDate.ClientID %&gt;'.value),GetTextBoxValue('&lt;%= txtATrendEndDate.ClientID %&gt;'.value))"&gt;Submit&lt;/asp:LinkButton&gt; </code></pre> <p>and</p> <pre><code>function checkDateRange(start, end) { } </code></pre> <p>Any Suggestion?</p>
javascript asp.net
[3, 9]
3,568,022
3,568,023
Replace Javascript click event with timed event?
<p>I've found some javascript code that layers photos on top of each other when you click on them.</p> <p>Rather than having to click I'd like the function to automatically run every 5 seconds. How can I change this event to a timed one:</p> <pre><code>$('a#nextImage, #image img').click(function(event){ </code></pre> <p>Full code below. Thanks</p> <pre><code>$(document).ready(function() { $('#description').css({ 'display': 'block' }); $('#image img').hover( function() { $(this).addClass('hover'); }, function() { $(this).removeClass('hover'); } ); $('a#nextImage, #image img').click(function(event) { event.preventDefault(); $('#description p:first-child').css({ 'visibility': 'hidden' }); if($('#image img.current').next().length) { $('#image img.current').removeClass('current').next().fadeIn('normal').addClass('current').css({ 'position': 'absolute' }); } else{ $('#image img').removeClass('current').css({ 'display': 'none' }); $('#image img:first-child').fadeIn('normal').addClass('current').css({ 'position': 'absolute' }); } if($('#image img.current').width() &gt;= ($('#page').width() - 100)) { xPos = 170; } else { do { xPos = 120 + (Math.floor(Math.random() * ($('#page').width() - 100))); } while(xPos + $('#image img.current').width() &gt; $('#page').width()); } if($('#image img.current').height() &gt;= 300) { yPos = 0; } else{ do { yPos = Math.floor(Math.random() * 300); } while(yPos + $('#image img.current').height() &gt; 300); } $('#image img.current').css({ 'left' :xPos, 'top' :yPos }); }); }); </code></pre>
javascript jquery
[3, 5]
4,854,474
4,854,475
Why jQuery function returns null?
<p>I have this form:</p> <pre><code>&lt;form action="javascript:;" class="iceFrm" enctype="application/x-www-form-urlencoded" id="frmMainMenu" method="post" onsubmit="return false;"&gt; ..... &lt;/form&gt; </code></pre> <p>I do not understand why this script:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).ready(function () { $("#frmMainMenu").$("#menuPopupAP").$("#menuItem0").$("#out").css('padding','0 0 0 29px'); }); &lt;/script&gt; </code></pre> <p>says:</p> <blockquote> <p><code>$("#frmMainMenu")</code> is null</p> </blockquote> <p>in Firebug.</p> <p><strong>UPDATE:</strong> This is the html element (from the above form) I want to change the padding on:</p> <pre><code>&lt;span id="frmMainMenu:menuPopupAP:menuItem0:out" class="iceOutTxt iceMnuItmLabel graMenuPopupMenuItemLabel"&gt;My Applications&lt;/span&gt; </code></pre> <p>Update 2:</p> <p>I've forgot to mention that this span is within a menu, so basically it's hidden normally and displayed only when hovering on some div... Does jQuery finds it even if it's not displayed?</p> <p>Do you know why?</p>
javascript jquery
[3, 5]
1,336,566
1,336,567
android indexoutofboundsexception passing bundle through intent
<p>I have stumbled upon an issue I can't figure out right now. I get an index out of bounds exception when I pass a bundle to a new activity in intent extras. </p> <p>I use the following code:</p> <pre><code>Intent intent = new intent(this, statelistactivity.class); Bundle bundle = new bundle(); Bundle.putInt("id", _id); Bundle.putString("name", _name); Intent.putExtras(bundle); startactivity(intent); </code></pre> <p>In the receiving activity I use:</p> <pre><code>String name = getIntent().getString("name); </code></pre> <p>Following the same principle for the int.</p> <p>However my code never gets here because of an <code>outofboundsexception</code>. What could cause this?</p>
java android
[1, 4]
3,244,491
3,244,492
Function in javascript or jquery like nl2br in php
<p>I need function in javascript or jquery like nl2br in php. Is there any function in javascript or jquery?if not suggest any equivalent solution.</p> <p>Thanks</p>
php javascript jquery
[2, 3, 5]
3,686,392
3,686,393
Is there any better way to do this in jquery?
<p>I want to know that is there any better method to do :</p> <pre><code>var name = $('input').attr("name") != "undefined" ? $('input').attr("name") : ""; </code></pre> <p>Here i am reading the <code>name</code> attribute of <code>input</code>. My problem is when i read the <code>name</code> for newly created <code>text</code> element, then it was <code>undefined</code>. So for not showing <code>undefined</code> to the user i have to put this check.Now i have to ready so many properties and in all of then the same problem exist so that`s why i want to know that, Is there any better way to deal will this?</p>
javascript jquery
[3, 5]
146,228
146,229
dynamic selector for onClick not working
<p>I want to make simple onClick event</p> <pre><code>$('._1').click(function(){ window.open('abc.html?parameter=1'); }); </code></pre> <p>in above case , i have _1 as a class, now there are multiple such elements, and 1 here also acts as parameter to window.open request</p> <p>but there are multiple click events i want to bind</p> <pre><code>var arrayOfValues = [1,2,4,6,7,8]; for(var z=0;z&lt;arrayOfValues.length;z++) $('._'+arrayOfValues[z]+'').click(function(){ window.open('abc.html?parameter='+arrayOfValues[z]); }); </code></pre> <p>but this is not working</p>
javascript jquery
[3, 5]
2,328,551
2,328,552
Making navigation links highlight when relevant element passes underneath it, using JavaScript/JQuery?
<p>I have a single page website with the navigation menu <code>position:fixed</code> at the top of the page. </p> <p>When I click a link from the navigation menu the page scrolls to the appropriate section using this JQuery:</p> <pre><code>$('a[href^="#"]').live('click',function(event){ event.preventDefault(); var target_offset = $(this.hash).offset() ? $(this.hash).offset().top : 0; $('html, body').animate({scrollTop:target_offset}, 1200, 'easeOutExpo'); }); </code></pre> <p>What I'd like to happen is when I manually scroll the page <code>$(window).scroll(function(){...});</code>, relevant to the section passing under the navigation menu <code>#navi-container</code>, the navigation link highlights using <code>.addClass('activeNav');</code> </p>
javascript jquery
[3, 5]
5,083,948
5,083,949
how to get the value from a CSS class object in javascript
<p>I have to select an <code>&lt;a&gt;</code> element from the given class of objects. when i click on the anchor tag in the <code>showcase_URL</code> class, i want the jquery function to get the value from <code>&lt;a&gt;</code> tag. How can this be done?</p> <p>I cannot make this an <code>id</code> as I am running a while loop to construct all the elements in php. there would be multiple objects of this class. there is no definite selector through which I can get the value of the anchor tag. Help would be much appreciated.</p> <pre><code> echo '&lt;div id="content"&gt;'; echo '&lt;div class="showcase_data"&gt;'; echo '&lt;div class="showcase_HEAD"&gt;'.$row-&gt;title.'&lt;/div&gt;'; echo '&lt;div class="showcase_TYPE"&gt;'.$row-&gt;type.'&lt;/div&gt;'; echo '&lt;div class="showcase_date"&gt;&amp;nbsp;&amp;nbsp;'.$row-&gt;date.'&lt;/div&gt;'; echo '&lt;div class="showcase_THUMB" style="float: left;" &gt;&lt;/div&gt;'; echo '&lt;div class="showcase_TEXT"&gt;'.$row-&gt;details.'&lt;/div&gt;&lt;br/&gt;'; echo '&lt;div class="showcase_URL"&gt;&lt;a class="purl" value='.$row-&gt;num.'href="'.$row-&gt;url.'"&gt;PROJECT URL&lt;/a&gt;&lt;/div&gt;'; echo '&lt;/div&gt;'; echo '&lt;/div&gt;'; </code></pre>
javascript jquery
[3, 5]
3,617,225
3,617,226
Redirect user to a specific page after login
<p>In web application, after login "ReturnUrl" going to last visited page. How to set to go default.aspx.</p> <p>I declared code in web.config like this.</p> <pre><code> &lt;forms name="FormsAuth" loginUrl="Default.aspx" defaultUrl="Default.aspx" path="/" timeout="200" slidingExpiration="true"&gt; </code></pre> <p>But If I close application at <code>/Private/Admin/ReviewIssue.aspx</code> page. </p> <p>When I start again application in login page url has like this</p> <pre><code> http://localhost:3042/Test/Default.aspx?ReturnUrl= %2fPrivate%2fAdmin%2fReviewIssue.aspx </code></pre> <p>I want from login page to Default.aspx only.</p>
c# asp.net
[0, 9]
3,694,768
3,694,769
jQuery looping through .children of .children
<p>I've been looking over previously asked questions and can't seem to find a solution for my scenario...</p> <p>I'd like to be able to loop through all children and children of children, etc...</p> <p>the markup from design looks similar to this</p> <pre><code>&lt;div&gt; &lt;div&gt; &lt;label&gt;&lt;/label&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;&lt;/label&gt; &lt;/div&gt; &lt;div&gt; &lt;label&gt;&lt;/label&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>I'd like to be able to select all labels within a specific div, regardless of their direct parent.</p>
javascript jquery
[3, 5]
1,958,652
1,958,653
Is it possible to use a variable by providing its name through reflection?
<p>I'm trying to get access to some string resources generated in R.java class at runtime.</p> <p>R.java :</p> <pre><code> public static final class string { public static final int app_name=0x7f040000; public static final int eightOvereight=0x7f040030; public static final int eightOvernine=0x7f040031; public static final int fiveOvereight=0x7f040027; public static final int fiveOverfive=0x7f040024; public static final int fiveOvernine=0x7f040028; public static final int fiveOverseven=0x7f040026; public static final int fiveOversix=0x7f040025; public static final int fourOvereight=0x7f040022; public static final int fourOverfive=0x7f04001f; { </code></pre> <p>At runtime I have:</p> <pre><code> String current = getStringId(); // assume current = "eightOvereight" after this line //now I would like to use R.string.eightOvereight. I don't want to use a switch statement. </code></pre> <p>Can I achieve this through reflection?</p>
java android
[1, 4]
72,580
72,581
jquery custom filter does not work
<p>The filter itself is pretty easy:</p> <pre><code>$.expr[':'].valid = function(a) { var phone = a.value.replace(/\D/g,''), phonesub = phone.substr(0, 2); return (phonesub == '79' || phonesub == '89') &amp;&amp; phone.length == 11 } </code></pre> <p>I just want to check if <code>phone</code> length us 11 and it starts with <code>79</code> or <code>89</code>. However:</p> <pre><code>$(":valid") [&lt;input type=​"text" id=​"phone1" name=​"phone1" value&gt;​] </code></pre> <p>it's clear that value is "".</p> <p>Why my filter doesn't work?</p> <p>BTW, at the same time, there is another input on the DOM:</p> <pre><code>&lt;input type="text" id="phone2" name="phone2" value="" disabled=""&gt; </code></pre> <p>and it's not getting matched by the filter. Is it affected by <code>disabled</code>?</p> <p>Let's change it's value:</p> <pre><code>$("#phone2") [&lt;input type=​"text" id=​"phone2" name=​"phone2" value disabled&gt;​] $("#phone2").val("79111111111") [&lt;input type=​"text" id=​"phone2" name=​"phone2" value disabled&gt;​] $("#phone2").val() "79111111111" $(":valid") [&lt;input type=​"text" id=​"phone1" name=​"phone1" value&gt;​] </code></pre> <p>I'm desperate</p>
javascript jquery
[3, 5]
3,019,150
3,019,151
can we store fadeOut method in a variable
<p>i have a jquery slider function and i want to customize it. my requirement is i want store fadeout effect in variable but i am not getting any idea. i spent some time on the internet to find out the solutions but not reaching up to the solutions. so there is any solutions regarding this. if yes please let me know it will be very helpful for me.</p> <pre><code>var mYname=fadeOut(500) </code></pre> <p>or</p> <pre><code>if (option[12]/*prevNext*/) eA[fadeOpacity ? 'fadeIn' : 'fadeOut' ](fadetime); </code></pre>
javascript jquery
[3, 5]
5,800,652
5,800,653
How to fill a Spinner with a loop in Android?
<p>How can i fill a spinner from - 1 to 40 elements via a loop.</p> <p>When the program first starts ?</p> <p>And how to read the value that i pick from the list ?</p> <p>thanks in advance</p>
java android
[1, 4]
983,605
983,606
Correct Syntax to Include object data in jquery selector
<p>I'm trying to make a jquery selector as per the below code. However, my js is pretty poor and i'm not sure what the correct syntax is to use data.key as the value here (data.key should have a numeric value btw). I'd know how to do this in php! But not sure here :(</p> <pre><code>onClick: function(data) { if($(".myForm select option[value=data.key]").is(':selected')){ alert('foo'); } } </code></pre> <p>Any advice would be very gratefully received!</p> <p>Thanks!</p>
javascript jquery
[3, 5]
1,868,289
1,868,290
Button Shown as pressed on start of Activity in Android
<p>How can i show a button as it is pressed whenever the activity is created and UI is shown to user in Android?</p>
java android
[1, 4]
5,307,532
5,307,533
Having a single event listener for custom events generated by any element in the page
<p>I am in the process of creating a huge web application, with a JavaScript based UI, and many events generated continuously.</p> <p>To avoid bad performance due to the huge amount of the event listeners needed, I of course opted to use a single event listener which will catch all the events generated from the children elements (event bubbling).</p> <p>The problem is, this application is designed in such a way that one or more modules can be loaded into the main JavaScript library I'm coding (which is responsible for controlling the UI and every other aspect of the program). Of course every module should be completely independent from each other, so you can choose which methods to load, without affecting the general functionality of the library, only adding or removing features.</p> <p>Since every module can operate in different DOM elements, I need to have at least a single event listener for each module, since two modules can listen for events generated by html elements placed in different DOM branches.</p> <p><a href="http://jsfiddle.net/YRejF/2/" rel="nofollow">http://jsfiddle.net/YRejF/2/</a></p> <p>In this fiddle for example, the first button will let the first paragraph trigger an event, and its parent will catch it. The second button will let the second paragraph fire the event, but the div listening for the same event won't catch it, because it's not fired from one of its sons.</p> <p>So my question is: is it possible to have a single event listener, able to listen also to events triggered from elements that are not its sons (elements placed everywhere on the page)?</p> <p>I was thinking about having a js object, or a dom node, which store the data of the element which triggered the event, and the event itself, then a general event will be fired on the global event listener (no matter where it's placed in the dom), and it will then read the data to discover which element generated which event, and act accordingly.</p> <p>Any help or suggestion about better ways of achieving this?</p>
javascript jquery
[3, 5]
2,083,889
2,083,890
Get FileChannel from AssetManager Android
<p>I want to get a FileChannel from the AssetManager in android, is there any way to do this? I want to map some raw custom binary files to some buffers. (If you have a better solution than AssetManager, please feel free to contribute)</p>
java android
[1, 4]
5,537,035
5,537,036
Is it possible to get a selector using indexOf
<p>Like</p> <pre><code> &lt;div id="box_1"&gt; &lt;div id="box_2"&gt; &lt;div id="box_3"&gt; </code></pre> <p>If i want to get all id's starting with 'box_' how can i do it something like this..</p> <pre><code> $("#box_" + anything ) </code></pre> <p>Unfortunately wrapping the div's won't work because it will get all the other divs in side and between the box divs.</p> <p>I guess i can give them all another class and reference it like that, but just wondering if there's something like this out there.. thanks.</p>
javascript jquery
[3, 5]
4,230,231
4,230,232
Changing image src onClick with jQuery
<p>I am using this HTML on my site: <code>&lt;a href="#1" id="slick-toggle"&gt;&lt;img src="img1.jpg"/&gt;&lt;/a&gt;</code></p> <p>When I click this link, I would like to change the image src to <code>img2.jpg</code>. And revert back to <code>img1.jpg</code> when clicked again &amp; so on. <strong>Can someone explain how I do this using jQuery?</strong></p> <p>Here is my existing <strong>jQuery</strong> if this helps:</p> <pre><code>$(document).ready(function() { $('#slick-toggle').click(function() { $('#slickbox').toggle(400); return false; }); }); </code></pre> <p>Many thanks for any pointers with this :-)</p>
javascript jquery
[3, 5]
1,490,207
1,490,208
Get the the last inserted record in the code behind
<p>I have an insert stored procedure likes this </p> <pre><code> insert into Profile_Master(FirstName,LastName,Dob,Gender,MobileNo,Country,State,EmailId,Password) values (@FirstName,@LastName,@Dob,@Gender,@MobileNo,@Country,@State,@EmailId,@Password) set @id=SCOPE_IDENTITY() return end </code></pre> <p>I want to get the last inserted record in the code behind,how to catch the value?</p> <pre><code> pid = cmd1.Parameters.Add("@id", System.Data.SqlDbType.Int); pid.Direction = System.Data.ParameterDirection.Output; int res = Convert.ToInt32(pid.Value); HttpContext.Current.Session["value"] = res.ToString(); </code></pre> <p>here i am getting res as 0 so the values are not getting updated in the second page.</p>
c# asp.net
[0, 9]
4,113,135
4,113,136
Javascript error while executing alert function through php
<p>I am using fusion maps in one of my application.</p> <p>In one of the example i have to pass the value from one map to another charts,</p> <p>I am facing one problem if the data passed is numeric its displaying alert message correctly but if it is a string it generates an error:</p> <pre><code>NM is not defined </code></pre> <p>javascript:alert(NM)()</p> <p>My code is as below:</p> <pre><code>$strXML .= "&lt;entity id='" . $rs1['Internal_Id'] . "' value='" . round((($rs1['datap'] / $sumdata) * 100),2) . "' link='javascript:alert(".($rs1['Internal_Id']) . ")' /&gt;"; </code></pre> <p>If i change the link part (passing single quotes in alert)that is:</p> <pre><code>$strXML .= "&lt;entity id='" . $rs1['Internal_Id'] . "' value='" . round((($rs1['datap'] / $sumdata) * 100),2) . "' link='javascript:alert('".($rs1['Internal_Id']) . "')' /&gt;"; </code></pre> <p>It displays invalid xml data.</p> <p>Please help me on this</p> <p>Thanks</p> <p>Pankaj</p>
php javascript
[2, 3]
5,756,487
5,756,488
JQuery: get a child as you append it
<p>I am appending p tags to a div as I process a json request and would liek to style it according to what is in the request.</p> <pre><code>$(document).ready(function() { function populatePage() { var numberOfEntries = 0; var total = 0; var retrieveVal = "http://www.reddit.com/" + $("#addressBox").val() + ".json"; $("#redditbox").children().remove(); $.getJSON(retrieveVal, function (json) { $.each(json.data.children, function () { title = this.data.title; url = this.data.url; ups = this.data.ups; downs = this.data.downs; total += (ups - downs); numberOfEntries += 1; $("#redditbox").append("&lt;p&gt;" + ups + ":" + downs + " &lt;a href=\"" + url + "\"&gt;" + title + "&lt;/a&gt;&lt;p&gt;"); $("#redditbox :last-child").css('font-size', ups%20); //This is the line in question }); $("#titlebox h1").append(total/numberOfEntries); }); } populatePage() $(".button").click(function() { populatePage(); }); }); </code></pre> <p>Unfortunately things are not quite working out as planned. The styling at the line in question is applying to every child of the div, not just the one that happens to be appended at the time, so they all end up the same size, not sized dependent on their numbers.</p> <p>how can I apply a style to the p tags as they are appended ot the div?</p> <p>Edit: Thanks Fortes and Veggerby both worked, but i went with Fortes in the end because I did.</p>
javascript jquery
[3, 5]
4,561,776
4,561,777
What is the correct way to set up and display a JavaScript alert message in ASP .NET?
<p>I'm completely new to working with JavaScript in ASP .NET so bear with me.</p> <p>Say I have the following:</p> <pre><code>protected void btnCreateReplication_Click(object sender, EventArgs e) { try { doSomething(); } catch (Exception ex) { //How do I display the error? I know if I were in WinForms, I could just do this: MessageBox.Show(ex.Message); } } </code></pre> <p>First question: </p> <ol> <li>Should I put all of my JavaScript code in a .js file in my ASP .NET solution?</li> <li>If so, how do I call an alert message from the .js file?</li> <li>If not, how do I call an alert message instead of the MessageBox.Show?</li> </ol>
c# javascript asp.net
[0, 3, 9]
739,737
739,738
create an email drop box with php, javascript etc
<p>I am in the midst of creating an online contact management tool for users to manage contacts and clients. I am trying to develop a solution where the user will add a <code>BCC</code> or <code>CC</code> in any email client like this:</p> <pre><code>1234@myappdomain.12345.com </code></pre> <p>and my app will grab the recipients <code>to</code> address information email, name, etc and my backend script will grab the data, look to see if this exist and if not add this into the database. </p> <p>Where I am challenged is how to get the data from an email to php or java... Any thoughts?</p>
java php javascript jquery
[1, 2, 3, 5]
2,093,698
2,093,699
How to print specific day's date in month using jquery or php
<p>For example, I select March 2013 month and I want to print the all dates of Sunday in this month. How can I print a specific day's date in month using jquery or php?</p> <pre><code>jQuery(function () { jQuery("#datepicker").datepicker({ dateFormat: 'dd-mm-yy' }); var day = new Date(); var month = day.getMonth() + 1; var date = day.getDate() + '-' + month + '-' + day.getFullYear(); jQuery("#datepicker").val(da`enter code here`te); }); </code></pre>
php javascript jquery
[2, 3, 5]
238,575
238,576
making an inline C# call in external Javascript file
<p>With my javascript getting bigger and bigger, I want to clean up my ASPX File.</p> <p>The problem is alot of my javascript involves a lot of inline C# calls. ie:</p> <pre><code>'&lt;%=C# method call)%&gt;' </code></pre> <p>But this doesn't seem to work when its tucked away in a .js file. </p> <p>Is there a workaround so I can seperate my javascript into js files?</p>
c# javascript asp.net
[0, 3, 9]
338,226
338,227
FormsAuthentication, Roles does not exist even when Systems.Web are included
<p>So I copied the Registration page that came with ASP.NET to my own page, but for some reason the FormsAuthentication, Roles does not exist in the current context anymore. I have already included the appropriate files.</p> <pre><code> protected void RegisterUser_CreatedUser(object sender, EventArgs e) { FormsAuthentication.SetAuthCookie(RegisterUser.UserName, false /* createPersistentCookie */); Roles.AddUserToRole(RegisterUser.UserName, "User"); } </code></pre> <p>And here are what's included:</p> <pre><code> using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.Security; </code></pre> <p>And here is the ASP.NET section that I copied:</p> <pre><code>&lt;asp:CreateUserWizard ID="RegisterUser" runat="server" EnableViewState="false" OnCreatedUser="RegisterUser_CreatedUser"&gt; &lt;LayoutTemplate&gt; &lt;asp:PlaceHolder ID="wizardStepPlaceholder" runat="server"&gt;&lt;/asp:PlaceHolder&gt; &lt;asp:PlaceHolder ID="navigationPlaceholder" runat="server"&gt;&lt;/asp:PlaceHolder&gt; &lt;/LayoutTemplate&gt; &lt;WizardSteps&gt; &lt;asp:CreateUserWizardStep ID="RegisterUserWizardStep" runat="server"&gt; &lt;ContentTemplate&gt; ..... &lt;/ContentTemplate&gt; &lt;CustomNavigationTemplate&gt; &lt;/CustomNavigationTemplate&gt; &lt;/asp:CreateUserWizardStep&gt; &lt;/WizardSteps&gt; &lt;/asp:CreateUserWizard&gt; </code></pre>
c# asp.net
[0, 9]
535,594
535,595
Which is best way to design a webpage?
<p>I'm interested in developing a website using asp c#. I am new to asp.net c# platform. I want to design a website with css styles that have drop down menu items and new style. So how to start design and which software should I use?</p>
c# javascript asp.net
[0, 3, 9]
12,118
12,119
Soft reference and weak reference
<p>I'm cursious about the soft and weak references in the Java environment. I have also read a bit about both topics. Just to sum up, the weak reference are as the name says, weak references to an object. This means that the reference to this object is easily collected by the <code>GC</code>. A weak reference is created this way:</p> <pre><code>WeakReference&lt;SomeOtherRef&gt; weakReference = new WeakReference(someOtherRef); </code></pre> <p>On the other hand a soft reference will stick around much longer than a weak reference. So my question is:</p> <p>In my application, I have a custom adapter for a <code>ListView</code> This class will handle all the basic <code>ListView</code> stuff as handling clicks etc. When the user click on off the items in my list, a AsyncTask will be started. </p> <pre><code>convertView.setOnClickListener(new OnClickListener() { public void onClick(View v) { LoadCase loadCase = new LoadCase(position, holder); loadCase.execute(""); } }); </code></pre> <p>For now I dont show any progressDialog, for one reason. The <code>context</code> object. My problem is that the <code>Activity</code> which will initialize the CustomAdapter holds many object, and I have to pass a reference to the <code>Activity Context</code> in order to show a <code>ProgressDialog</code>, this <strong>will</strong> cause memory leaks, yes, I have tried. Is it safe to apply the Weak/Soft reference to deal with this? A <code>WeakReference</code> can be, at some time, null..this will cause a <code>NullPointerException</code> when I try to initialize my <code>ProgressDialog</code>. </p>
java android
[1, 4]
2,701,357
2,701,358
Can a browser on the client side add JavaScript on our website?
<p>Can any client add his JavaScript on my website?</p>
javascript android
[3, 4]
5,660,278
5,660,279
jQuery this var outside of anon function
<p>I'm trying to achieve something like this. Any ideas?</p> <pre><code>function test(that){ $(that).blur(); } $("#form").focus(test(this)); </code></pre>
javascript jquery
[3, 5]
3,377,533
3,377,534
Why is page refresh triggering .keyup()?
<p>I have this function:</p> <pre><code>$('.PhoneNumbers').on('keyup focusout', $('input:text[name^="Customers[0].PhoneNumbers"]'), function (e) { phoneRadioBtns(e); }); </code></pre> <p>The problem is that when I refresh the page it triggers the keyup event and it executes the function, which is not the desired result. Does anyone know how to correct this?</p>
javascript jquery
[3, 5]
2,792,448
2,792,449
Replace strings in native .exe using c#
<p>how can I catch all strings from a native windows .exe file and replace them later with others using c# ?</p> <p>Background: I want to create a c# tool to extract and replace strings from a simple .exe file.</p> <p>Is this possible somehow?</p>
c# c++
[0, 6]
3,925,362
3,925,363
Cloning or adding an input to a form in jQuery does not submit to PHP in Firefox
<pre><code>$('#images_upload_add').click(function(){ $('.images_upload:last').after($('.images_upload:last').clone().find('input[type=file]').val('').end()); }); </code></pre> <p>using this code to append file input's does not upload the file in firefox.</p> <p>also</p> <pre><code>$('#image_server_add input[type=button]').click(function(){ var select = $(this).siblings('select').find(':selected'); if(select.val()){ $('#image_server_add').before('&lt;tr class="images_selection"&gt;&lt;td&gt;&lt;input type="button" value="Delete"&gt;&lt;/td&gt;&lt;td class="main"&gt;'+select.html()+'&lt;input type="hidden" value="'+select.html()+'" name="images_server[]"/&gt;&lt;/td&gt;&lt;/tr&gt;'); } }) </code></pre> <p>also does not upload the values to the $_POST</p> <p>I can't find anything to say why this wouldn't work in the documentation, this works in IE but not it Firefox/WebKit</p> <p>Why wouldn't these examples correctly upload the form values?</p>
php javascript jquery
[2, 3, 5]
1,756,312
1,756,313
Asp.net is it possible to check page_load a click event is triggered?
<p>When a button is clicked, I would like to check whether a button is clicked in my page_load. Is this possible? I am using asp.net 2.0 C#</p>
c# asp.net
[0, 9]
4,715,080
4,715,081
$ is not a function, although jQuery is loaded
<p>Take a look at this site: </p> <p><a href="http://www.magiskecirkel.no/" rel="nofollow">http://www.magiskecirkel.no/</a></p> <p>It says $ is not a function, although jQuery is loaded.</p> <p>I know I have asked this question before, and it was fixed, but now apparently the problem is back... So sorry for re-posting, and thanks for all help. </p>
javascript jquery
[3, 5]
573,709
573,710
Add one year with months to dropdownlist
<p>I'm stuck at trying to generate a dropdownlist where i have both year and month showing.</p> <p>The dropdown must have 1 year showing like below.</p> <ul> <li>"Nov 2012"</li> <li>"Oct 2012"</li> <li>"Sep 2012"</li> <li>"Aug 2012"</li> <li>"Jul 2012"</li> <li>"Jun 2012"</li> <li>"May 2012"</li> <li>"Apr 2012"</li> <li>"Mar 2012"</li> <li>"Feb 2012"</li> <li>"Jan 2012"</li> <li>"Des 2011"</li> </ul> <p>That should be one year of months.</p> <p>I'm using this javascript to submit on the dropdownlist:</p> <pre><code>$('.dropdownMonthYear').change(function () { var values = $('.dropdownMonthYear').val().split(","); var month = values[0]; var year = values[1]; window.location = '/Garage/Top10Cars.aspx?month=' + month + '&amp;year=' + year; }); </code></pre> <p>Codebehind:</p> <pre><code>month = Convert.ToInt32(Request.QueryString["month"]); year = Convert.ToInt32(Request.QueryString["year"]); </code></pre> <p>Anyone know how this can be done?</p>
c# asp.net
[0, 9]
1,933,655
1,933,656
Managing this scope in javascript
<p>I am trying to get this function to get the correct scope for its "this" operator, but no luck. Inside the <code>AssetName = function(options){</code> code block, I want the "this" to point to the class <code>AssetName</code>. What is it that I am missing? The scope of <code>this</code> right from the beginning is <code>window</code>.</p> <pre><code>Assetname: function(options){ var Base = WM.Utility.GenericFilter() options = options; if (typeof Object.create !== "function") { // For older browsers that don't support object.create Object.create = function (o) { function F() {} F.prototype = o; return new F(); }; } var AssetName = {}; AssetName = function(options){ return function(){ var self = this; debugger; // Call the super constructor. Base.call(this, options); this.$mod.on('change', '#asset-name-quick-search', self, this.search); this.$mod.on('click', '.close', self, this.remove); this.initTypeAhead(); this.$selectionList = this.$mod.find("#asset-name-selection-list"); this.assetListItems = []; return this; }(options, AssetName); } // The AssetName class extends the base GenericFilter class. AssetName.prototype = Object.create(Base.prototype); AssetName.prototype.initTypeAhead = function(){ var options = {}; options.source = _.pluck(this.collection, 'asset_name'); options.items = 8; this.$mod.find('#asset-name-quick-search').typeahead(options); }; AssetName(options); return AssetName; }, </code></pre>
javascript jquery
[3, 5]
5,302,874
5,302,875
detect click inside iframe
<p>i wanna detect click INSIDE iframe not onclick on iframe itself i tried onclick event u must click on iframe itself to trigger function i even tried addeventlistener to window or document nothing work as if the iframe isn't there the function never triger when i click inside iframe :( plz help</p>
javascript jquery
[3, 5]
2,021,261
2,021,262
JQuery '$(this)'
<p>Why and when would you use <code>$(this)</code> instead of <code>this.</code>?</p>
javascript jquery
[3, 5]
1,770,199
1,770,200
Difference between %5B% and %5B0%?
<p>jQuery .serialize() turns "[]" into %5B%5D</p> <p>PHP http_build_query seems to turn the first "[]" into %5B0%5D, the second into %5B1%5D, etc. So it seems to be using some kind of counter.</p> <p><strong>Why are there differences in these almost identical functions?</strong> </p> <p>Is it just my browser that makes them different? How can I make sure the http_build_query doesn't add the extra counter (or let jQuery know I need the extra counter).</p>
php jquery
[2, 5]
1,488,267
1,488,268
Disable select, copy and paste of the content of HTML pages in Mozilla Firefox
<p>I want to disable select, copy and paste of the content of HTML pages in Mozilla Firefox. I have used jQuery and JavaScript to disable right-click and copy, select, paste of the contents of HTML pages and it's working fine in IE and Chrome, but not working properly in Mozilla Firefox.</p> <p>Can we disable copy, paste option in Mozilla Firefox? Any suggestions?</p>
javascript jquery
[3, 5]
984,990
984,991
How can I save video files to the SD card?
<p>I have an app which plays videos from <code>res/raw/</code>. The problem is that it uses nearly 40 MB of memory, which is way too much. The other version which plays the same video from the SD card uses only around 500 KB of memory. But I can't ask the users of my app to download the videos and store them in a particular folder on their SD card. So I need some way to save the videos immediately to the SD card (in <code>installation/first start</code>) and not load them into memory.</p> <p>Is this possible?</p>
java android
[1, 4]
4,231,260
4,231,261
jQuery checking which radiobutton is checked
<p>I got 2 radiobutton and 1 radcombobox</p> <pre><code>&lt;asp:RadioButton ID="cbxYes" Width="60" Height="30" runat="server" GroupName="proffesional" OnCheckedChanged="cbxYes_CheckedChanged" /&gt; &lt;asp:RadioButton ID="cbxNo" runat="server" Width="60" Height="30" GroupName="proffesional" Checked="true" OnCheckedChanged="cbxNo_CheckedChanged" /&gt; &lt;telerik:RadComboBox ID="dblSelect" EnableEmbeddedSkins="false" BackColor="Black" ForeColor="#d8d8d8" runat="server" Width="200" Height="30" &gt;&lt;/telerik:RadComboBox&gt; </code></pre> <p>. don't use <code>clientidmode=static</code> and i want to show or hide radcombobox according what radiobutton is checked.</p> <p>I have written this code:</p> <pre><code>&lt;script type="text/javascript"&gt; $(document).load(function () { var dropdown = $('#&lt;%= dblSelect.ClientID%&gt;'); var radio1 = $('#&lt;%= cbxYes.ClientID%&gt;'); var radio2 = $('#&lt;%= cbxNo.ClientID%&gt;'); if ((radio1.is(':checked').val()) == 'true') { dropdown.is(':visible').val() = 'true'; }; if((radio2.is(':checked').val() == 'false'){ dropdown.is(':visible').val() = 'false'; }; }); &lt;/script&gt; </code></pre> <p>What am I doing wrong?</p> <p>Thanks in advance :)</p>
jquery asp.net
[5, 9]
851,504
851,505
String to jQuery object, replace attribute and then back to string again (see JS Fiddle)
<p><a href="http://jsfiddle.net/r4KL9/" rel="nofollow">http://jsfiddle.net/r4KL9/</a></p> <p>This should replace all classes with the corresponding data-change attribute.</p> <p>So if I had:</p> <pre><code>&lt;div class="hello" data-change="new-class"&gt; </code></pre> <p>...I would expect it to return</p> <pre><code>&lt;div class="new-class" data-change="new-class"&gt; </code></pre> <p>My code changes one of them (the one on the button) but not the other.</p> <p>What am I doing wrong?</p> <p>Thanks for any help.</p> <p>--</p> <p>Apparently I need to post the JS Fiddle code too:</p> <pre><code>var str = '&lt;div class="original-class" data-change="new-class"&gt;Hello&lt;/div&gt;&lt;div class="class-123"&gt;&lt;input type="button" class="start-class" data-change="any-new-class" value="Click Me"&gt;&lt;/div&gt;'; var html = $('&lt;div/&gt;').html(str).contents(); $('[data-change]', html).attr('class', function() { return $(this).data('change') }); alert( $(html).parent().html() ); </code></pre>
javascript jquery
[3, 5]
1,801,123
1,801,124
asp:CreateUserWizardStep - The name 'UserName' does not exist in the current context
<p>i have TextBox inside <code>&lt;asp:CreateUserWizard \&gt; --&gt; &lt;WizardSteps&gt; --&gt; &lt;asp:CreateUserWizardStep\&gt; --&gt; &lt;ContentTemplate&gt;</code></p> <p>this TextBox ID is UserName.</p> <p>I'm facing a problem to push into this TextBox. when i do <code>UserName.Text = "some name";</code></p> <p>i get this error : <strong>"The name 'UserName' does not exist in the current context"</strong></p> <p>any help?</p> <p>thankes </p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if (Session["VolunteerSessionList"] != null) // test if exists { UserName.Text = "some name"; } </code></pre>
c# asp.net
[0, 9]
922,667
922,668
PLSA implementation in Python
<p>Is their any library containing implementation of PLSA (Probabilistic Latent Semantic Analysis) algorithm ? Preferably in python, but Java/C++ is also welcomed...</p>
java c++ python
[1, 6, 7]
3,613,096
3,613,097
Object function Function() { [native code] } has no method '_registerScript'
<p>I have site which has updatePanel and it is hosted on a web farm. Ive noticed that sometimes when I hit ctrl + r there is an js error:</p> <pre><code>Object function Function() { [native code] } has no method '_registerScript' </code></pre> <p>Requests before <code>ctrl+r</code> and on <code>ctrl+r</code> are made to the same server.</p> <p>What can be the sause of this problem ?</p>
c# asp.net
[0, 9]
3,812,926
3,812,927
Call jQuery SuperBox from cloned image object
<p>I have cloned image object inside my view. On that cloned object I want to bind <a href="http://pierrebertet.net/projects/jquery_superbox/" rel="nofollow">the jQuery SuperBox</a> effect. Since this effect by default is fired using <code>&lt;a href="#box-content" rel="superbox[content]"&gt;SuperBox&lt;/a&gt;</code>, how can I call this effect on my cloned object. Just to have wide picture I have completed the following steps:</p> <ol> <li>Thumb images are generated.</li> <li>On click, the image is cloned with different dimensions (big image).</li> <li>The cloned image is successfully loaded inside the corresponding div (showImage)</li> <li><p>How to call SuperBox on the cloned image using <code>onclick</code>?</p> <p>$('div#showImage').on('click', 'img', function () { alert("Hi"); // this works :) //need example to call superbox });</p></li> </ol>
javascript jquery
[3, 5]
3,339,210
3,339,211
Accessing data from other website to know if the client has paid or unpaid status after logging in
<p>We have been developing a web application, and we have utilized login system of this site <a href="http://www.cura2apptrade.herobo.com/index.php/" rel="nofollow">http://www.cura2apptrade.herobo.com/index.php/</a> , this is my site I have uploaded to a free web hosting company. We have just embedded its login system to another website which we are currently working on. The site indicated above is where the registration of the clients happens, the other site that we are working is where the client will log in. It works fine, however only the email and the password that we can access. </p> <p>What we want is to access the status of the client logging in in the website if he/she has a paid/unpaid status, paid status if the client has already paid the subscription, unpaid otherwise. But we don't yet get the right approach to get that information from a separated site. We have been trying to apply API but just don't get it right. I have read some to use JSONP but I do not how to use it right. Can anyone help us with this problem? </p> <pre><code>&lt;script type="text/javascript"&gt; $(function() { $.ajax({ url: 'http://www.cura2apptrade.herobo.com/bb-admin.php/invoice?status=unpaid?jsonp=?', dataType: "jsonp", jsonp: "callback", success: function(data) { $('#main').html(data); } }); }); &lt;/script&gt; </code></pre>
php javascript
[2, 3]
5,297,327
5,297,328
How can I elegantly select a parent including its set of direct descendents?
<p>I'm working with a mess of HTML markup. In order to get reliable matches I have resorted to explicitly querying a chain of elements using the <a href="http://docs.jquery.com/Selectors/child" rel="nofollow">'>' operator</a>.</p> <p>For this question I am attempting to select the parent of an explicit chain of descendents.</p> <p>For example, I'd like to select the table element with class 'toolbar' in the following HTML:</p> <pre><code>&lt;table class='toolbar'&gt; &lt;tbody&gt; &lt;tr&gt; &lt;td class='button'&gt; ... &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre> <p>Here is what I've tried:</p> <p><strong>1. Use 'has'</strong></p> <pre><code>$("table.toolbar:has(tbody &gt; tr &gt; td.button)") </code></pre> <p>Here elements are matched even if tbody isn't a direct descendent of table so this doesn't reliably work.</p> <p><strong>2. Use '>' and parent()</strong></p> <pre><code>$("table.toolbar &gt; tbody &gt; tr &gt; td.button").parent().parent().parent() </code></pre> <p>This works but is messy. Also have to make sure the correct number of parent() calls are included.</p> <p><strong>3. ???</strong></p> <p>Due to the crap HTML, it is critical that elements are explicitly given in the query as <strong>one direct descendent beneath another</strong>.</p> <p>Can anyone please help with the nicest way of doing this? <em>Thanks!</em></p>
javascript jquery
[3, 5]
1,512,444
1,512,445
how to control sound in android?
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/2539264/volume-control-in-android-application">Volume Control in android application</a> </p> </blockquote> <p>i m making an app for music player and i want to increase and decrease volume by using hardware buttons on mobile. so pls tell me any code to do this.</p>
java android
[1, 4]
5,608,822
5,608,823
Integrating jQuery BBQ into my current code?
<p>I am trying to integrate the <a href="http://benalman.com/projects/jquery-bbq-plugin/" rel="nofollow">jquery BBQ plugin</a> into my current code, at the moment I have set up a simple AJAX request that returns the selected links relative page. Can anyone tell me how I can modify the BBQ script so it will work with my code?</p> <pre><code>&lt;ul id="nav"&gt; &lt;li&gt;&lt;a href="index.html"&gt;Homepage&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="page1.html"&gt;Link 1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="page2.html"&gt;Link 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="page3.html"&gt;Link 3&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt; &lt;div id="inject"&gt; &lt;div id="main-content"&gt; &lt;p&gt;This is the homepage&lt;/p&gt; &lt;/div&gt; &lt;/div&gt; $('#nav').find('a').click(function(e) { $.ajax({ url : this.href, method : 'get', success : function(data) { var div = $('#main-content', $(data)); $('#inject').html(div); } }); e.preventDefault(); }); </code></pre>
javascript jquery
[3, 5]
5,230,747
5,230,748
How to combine click with hover function in same status?
<p>I try to add click function but it doesn't run...</p> <pre><code>$("#menu2 li").hover(function() { //On hover... $(this).find("span").stop().animate({ marginTop: "-40" //Find the span tag and move it up 40 pixels }, 250); $("#menu2 li").click(function() { //On click... $(this).find("span").stop().animate({ marginTop: "-40" //Find the span tag and move it up 40 pixels }, 250); } , function() { //On hover out... $(this).find("span").stop().animate({ marginTop: "0" //Move the span back to its original state (0px) }, 250); }); }); </code></pre> <p>here is the link:<a href="http://dl.dropbox.com/u/30777772/menu22.html" rel="nofollow">after click, i hope it still be white color</a></p>
javascript jquery
[3, 5]
3,148,808
3,148,809
Select all iframes inside the specific iframe?
<p>Jquery: How to select all iframes inside the specific iframe? I have a specific iframe, <code>id="main_frame"</code> so far I tried this one, but it don't work:</p> <pre><code>$("#main_frame").contents().find("iframe").each(function() { data = $(this); //somecode }); </code></pre> <p>This gets the data only for the #main_frame.</p>
javascript jquery
[3, 5]
5,639,716
5,639,717
jQuery: For each attribute of an input element how do I get that input element's name?
<p>I'm looking at each input element that has an attribute named "isDate". I want to find that attributes parent input element's name attribute.</p> <pre> &lt;input name="A0000" isDate="true" value="01/01/2020" /&gt; &lt;input name="A0001" isDate="true" value="01/01/2021" /&gt; &lt;input name="A0002" isDate="true" value="01/01/2022" /&gt; &lt;input name="A0003" isDate="true" value="01/01/2023" /&gt; &lt;input name="A0004" isDate="true" value="01/01/2024" /&gt; &lt;input name="A0005" isDate="true" value="01/01/2025" /&gt; $("input[isDate="true"]).each(function(){ var _this = this; // do stuff then... // get name of input var name = $(_this).parent().attr("name").val(); // this doesn't work }); </pre>
javascript jquery
[3, 5]
2,583,370
2,583,371
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]