Search Results

Search found 10381 results on 416 pages for 'delegate and events'.

Page 111/416 | < Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >

  • What's the recommended way to create an HTML elemnt and bind a listener to it using jQuery?

    - by Bytecode Ninja
    At the moment I achieve this using something like this: var myElem = "<tr id='tr-1'><td>content</td></tr>"; $("#myTable").append(myElem); $("#tr-1").click(function() { // blah blah }); Traditionally, when I wasn't using jQuery, I used to do something like this: var myElem = document.createElement(...); var myTable = document.getElementById("myTable"); myTable.appendChild(myElem); myElem.onclick = function() { // blah blah } The thing is, in the second approach I already have a reference to myElem and I don't have to scan the DOM ($("#tr-1")) to find it, like the jQuery approach, and hence it should be much faster especially in big pages. Isn't there a better jQuery-ish way to accomplish this task?

    Read the article

  • Linux signals with extra information parameter

    - by Tester
    I was to have some extra information in the callback to sa_sigaction handler, it does not seems possible. So I was wondering if you could suggest me alternatives. Basic requirements: Function A raises an signal/event with a pointer to a struct Handler function tackles the event. The handler function would only be called on an event and a loop to wait for the event, as in select() , is undesirable. TIA

    Read the article

  • Event click on youtube API

    - by Youss
    I'm working with Youtube API and Jquery. With a certain script I can get Youtube Feeds as an image, take a look at the example: JsFiddle I'm trying to do a Jquery click event which will have to invoke another script called 'embedly' like this: $("a").click(function(event) { event.preventDefault(); $(this).embedly({ chars: 220, nostyle: true, key:':41f042ec20b04dda84448dc4a46d357d' }); }); It doesn't seem to work. When I do this from my desktop the click does not invoke the embedly part and also goes to the url regardless of the prevent default.

    Read the article

  • SDL (And Others) Virtual Key Input

    - by David C
    Today I set up the input in my application for all the different keys. This works fine except for virtual keys, for example, caret or ampersand. Keys that normally need shift to be got at. Using SDL these virtual keys don't work. As in they do not register an event. if (event.type == SDL_KEYDOWN) { switch (event.key.keysym.sym) { case SDLK_CARET: Keys[KeyCodes::Caret] = KeyState::Down; break; case SDLK_UP: Keys[KeyCodes::Up] = KeyState::Down; break; default: break; } I am absolutely sure my system works with physical keys like Up. The program queries a keystate like so: if (Keys[KeyCode] == KeyState::Down) { lua_pushboolean(L, true); } else { lua_pushboolean(L, false); } KeyCode is passed in as an argument. So why are virtual keys, or keys that need shift to get at not working using SDL's KeyDown event type? Is more code needed to get to them? Or am I being stupid?

    Read the article

  • If element has been 'mouseover'ed for 500ms, run function with jQuery

    - by PaulAdamDavis
    For the sanity of my users, I want a 'mouseover' event to run after the selector has been hovered for half a second rather than as soon as they hover it. I first tried a setTimeout function but that runs however long the element has been hovered, I didn't think it through too much I guess. I've also spent a day (on and off) searching (and playing Pacman) ti no result, unless I'm searching for the wrong things. I would like to keep this plugin-less if we can, purely for run speed & maintainability. $("#mySelector").mouseover(function(){ // Run after 500ms $(this).addClass("hasBeen500ms"); }); Let's see if we can crack this, I know it will have so many applications!

    Read the article

  • How to get the textbox value in php?

    - by Nitz
    On my page. i have one textbox and one button. -- on the button click event. -- one function will be called. Now, How to get that value of textbox and store in php variable? this should be done in that function which we will call on button click.

    Read the article

  • How to raise an event when another event is raised?

    - by WulfgarPro
    Hi, I have an application that handles the OnQuit event of another running application. I would like to raise an additional (custom) event when the OnQuit event is handled. How could I implement such an event? My OnQuit handler is like so: private void StkQuit() { _stkApplicationUi.OnQuit -= StkQuit; Marshal.FinalReleaseComObject(_stkApplicationUi); Application.Exit(); } The reason I require the additional event is so that I can tell my View layer that the application has exited. If this is not the correct way, what would be better? WulfgarPro

    Read the article

  • Binding Javascript Event Handlers to a an Ajax HTML Response?

    - by John
    Let's say I have the following HTML code <div id="outer"> <div id="inner">Hello World</div> </div> At the end of my HTML page, I use javascript to attach event handlers like so, document.getElementById('inner').onclick = function() {alert(this.innerHTML);} document.getElementById('outer').onclick = function() { /* An Ajax Call where the response, which will be a string of HTML content, then goes into document.getElementById('outer').innerHTML */ document.getElementById('inner').onclick = function() {alert(this.innerHTML);} } In the above code, I am expecting <div id="inner">Hello World 2</div> to come back which requires me to re-attach the onclick event handler. This makes sense because the new response coming back is just a string, and I have to tell the browser that after converting to DOM, i also need some event handlers So my question is, is there a better way to manage event handlers on AJAX response that contains HTML content? I could use inline javascript within the html response, but then it prevents me from achieving non-intrusive javascript. So is there a way to achieve non-intrusive javascript and an efficient way to "maintain" event handlers of ajax html responses?

    Read the article

  • Java: Do something on event in SQL Database?

    - by wretrOvian
    Hello I'm building an application with distributed parts. Meaning, while one part (writer) maybe inserting, updating information to a database, the other part (reader) is reading off and acting on that information. Now, i wish to trigger an action event in the reader and reload information from the DB whenever i insert something from the writer. Is there a simple way about this? Would this be a good idea? : // READER while(true) { connect(); // reload info from DB executeQuery("select * from foo"); disconnect(); }

    Read the article

  • Switching back into the middle of a function in Actionscript

    - by J.Ded.
    I need to return to my original function after capturing an event (downloading something) with another function. The original function needs to return a value, which depends on the downloaded data. So, I'd like to pause original function for the time needed for the download and the eventhandler function to complete it's work, and resume it afterwards. The obvious way is to set a flag value (both the original function and the eventhandler are within the same class) and make the original function check it until the eventhandler function changes the flag. But that would be wasteful, and my AS is slow enough already:) [other parts of the application utilise some heavy graphics]. Is there another way? Like an event that gets captured "in the middle" of the function? Or some other form of flow control?

    Read the article

  • alert the object

    - by user295189
    I am setting an object like this n.name = n.name.join(String.fromCharCode(255)); n.description = n.description.join(String.fromCharCode(255)); I want to be able to alert(n); but it tells me [Object] is there a way to alert complete object? thanks

    Read the article

  • Results page in other window.

    - by xRobot
    I have this simple form: <form method="post" action"."> <input type="text" name="title"> <input type="submit" name"send"> </form> I want that when a user click on submit, then will be open another window of browser with the results. Is it possible ?

    Read the article

  • Clear All Event subscriptions (Clone linked)

    - by mattias
    I just implemented Clone from ICloneable and realized that the event subscriptions from my source instance also followed. Is there a good way to clear all those? Currently I am using a couple of these loops for every event I have to clear everything. foreach (var eventhandler in OnIdChanged.GetInvocationList()) { OnIdChanged -= (ItemEventHandler) eventhandler; } foreach (var eventhandler in OnNameChanged.GetInvocationList()) { ... This works fine but clutters the code a bit. Mostly worried to get event dangling.

    Read the article

  • Pulling .live() functionality out of jQuery

    - by Daniel
    I am writing a Firefox Add-On that currently is depending on jQuery for the following things: Selectors Animations A special .live("focus") hail-mary event-catching maneuver that happens to work with jQuery 1.4.2 (but not 1.4.4) jQuery isn't well suited for functioning inside XUL, and it's a miracle we've gotten this far with it. We're trying to remove the jQuery requirements, the first two are easy (animations are simple, and we can use .querySelector() instead of jQuery), but the .live has proven impossible to do on our own. I've tried reading the source code, but I haven't been able to piece it apart. What is the jQuery .live function doing? There's clearly a lot more going on than document.addEventListener("focus"/"focusin",function_to_pick_apart_events). What else is going on here?

    Read the article

  • Further Details on Vallidating Event not Working....

    - by Sameep
    I have created a custom control that inherit the TextBox, in that control i have override validating event and in validating event i have put validation that checks for the empty field. Now when i use that control on my winform and when i click on save button it immediate fires save event.. the validation event of custom control fires and it displays the error message but still it does not stop the save event to fire.... the save button CauseValidation Property is set to true.. i have also put (this.ValidateChildren()) i have also put CancelEventArgs ce.Cancel = true; in Custom Textbox control but neither working to stop the save event to fires.. i only want to fire Save event if Textbox is not empty. validating event fires, shows message for empty field and immediate fires save event.. now if you got an idea then if you have solution then please provide solution..

    Read the article

  • Problem with Firefox, javascript, and Canvas

    - by Rob
    I'm having a Firefox-specific issue with a script I wrote to create 3d layouts. The correct behavior is that the script pulls the background-color from an element and then uses that color to draw on the canvas. When a user mouses over a link and the background-color changes to the :hover rule, the color being drawn changes on the canvas changes as well. When the user mouses out, the color should revert back to non-hover color. This works as expected in Webkit browsers and Opera, but Firefox chokes on it if mouseout is triggered and no mouseover event follows it. This is easier to see than for me to describe, and it's too much code to post here, so here is a link: http://www.robnixondesigns.com/strangematter/

    Read the article

  • How to hook onclick event for each cell in a table in Javascript?

    - by MartyIX
    I was thinking if there's a better solution for adding onclick handler to each cell in a table than this approach: http://stackoverflow.com/questions/1207939/adding-an-onclick-event-to-a-table-row Better in the way that I wouldn't need to set "cell.onclick = function" for each cell. I just need to get the coordinations of a cell where user clicked. Thanks!

    Read the article

  • Disable (and re-enable) the href and onclick on elements

    - by jibees
    Hello I just want to enable / disable onclick and href on elements (a or div). I don't know how to do this. I can disable onclick by adding an handler on click event, but the href is still available. $(this).unbind().click(function(event){ event.preventDefault(); return; }); FOUND A HACK FOR A ELEMENTS if ($(this).attr("href")) { $(this).attr("x-href", $(this).attr("href")); $(this).removeAttr("href"); }

    Read the article

  • How to trigger an event ONLY if both dropdowns are selected?

    - by DaveDev
    I have a dropdown select list on my page of class="TypeFilter". I have a jQuery event that fires when a value in that list is selected. $(".TypeFilter").change(function() { // Extract value from TypeFilter and update page accordingly )); I now have to add another list to the page, and I want to implement functionality which will prevent the .change(function() from running unless both are selected. In both lists the first option in the list is some text instructing the user to select one of the items, so I was thinking of just writing some logic to test that both lists have a selected index greater than 0. I think this is a touch unclean though, especially considering that other pages that have a TypeFilter use the same logic. Is there any nifty functionality in jQuery that can do this?

    Read the article

  • Another way to handle a common JQuery event handling pattern

    - by bradgonesurfing
    I have the following code for example $("a.foo").bind(function (e){ var t; if ( $(e.target).is("a") ){ t = $(e.target); }else{ t = $(e.target).parent("a"); } var data = t.attr("data-info"); }); In english. I might have a list of anchors within which there may be a number of spans. Each anchor is declared as <a class="foo" href="#" data-info="1"> <span> ... </span> <span> ... </span> </a> <a class="foo" href="#" data-info="2"> <span> ... </span> <span> ... </span> </a> ... ... I bind a handler to the click event of the anchor but the event object comes back with the anchor OR one of the spans depending on where I click. So to get my html5 "data-info" value into the callback I have to insert a bit of messy code. This is now appearing throughout my code to the point where I am guessing there might be an idiomatic JQuery way of handling this.

    Read the article

  • jquery not select?

    - by acidzombie24
    i have a click event for $('#blah div'). div has text inside of it (not inside a div, span, p, etc) and has a textarea in it. The textarea is triggering the event as well, how do i make it only trigger when i click the text and ignore the textarea?

    Read the article

< Previous Page | 107 108 109 110 111 112 113 114 115 116 117 118  | Next Page >