input

clear default value

I found a lot of examples but I'm trying to figure out the simplest way to clear an input's default value when clicking it. This is for a search box. I have "Search for post" and I want to clear that when clicking on it. I tried using jquery but for some reason it doesn't work. $('#search').click(function() { if($(this).va...

How to use jQuery to display labels and input values?

I need a jQuery function that'll go through paragraphs with the following structure: <p> <label>some label</label> <input type="text" value=""/> </p> The function should use the label text as input value. Thanks! ...

compute sum dynamically with javascript

I have two textboxes Num1 and Num2 and another textbox Sum having the value 10. How can I do this wherein if the user will enter a number for Num1, it will add it to Sum and dynamically change the displayed number in the Sum textbox. If the user will enter a number in Num2 it will also add that number to the updated number shown in Sum ...

"Input Submit" Cross-browser compatibility

<input type="submit" value="Share" /> In Chrome/Safari: In FF: Can someone please tell me why they don't look the same? Even, when I set the font-size, font-family, padding and margin, the button in FF will always look bigger than the one in Chrome/Safari. D: ...

Set default button on html elements with jquery plugin

I am looking at writing a jquery plugin that takes a number of input elemts such as input elements, textareas, select html elements etc and once the enter key is pressed in any of the above items, a input button is triggered. As such, the button is set as the default for the fields. Any tips on doing this? ...

C++ console game input && refresh function

Hello, I am writing a small console adventure game and I faced a few problems. 1. The input is kinda laggy, I'm using while loop ( while(getch() == 'w') ). After a key is pressed the first time, nothing happens (you have to press it 2 times) and if you switch directions (press key A/D/S) it also doesn't react the 1st time. If you hold a ...

C++ input question

Hello! I am attempting to build a small local-purpose 3d engine, which has to be platform-independent and right now I'm looking for a way to handle different possible types of user input. This, obviously, includes mouse / keyboard events and possibly, another analogue controllers (joysticks, for example). I can think of several ways to...

LWJGL won't read keyboard input

I'm trying to use LWJGL to get whether a key is pressed. If the escape key is pressed, then the application quits. However, I can't get it to read any keyboard input, although Display.isCloseRequested() works fine. I'm on RHEL using LWJGL 2.6 and Java 1.6. for(;;) { // check if we want to quit if(Keyboard.isKeyDown(Keyboard...

Key event handlers don't fire at the form level

{Form constructor} this->KeyDown += gcnew KeyEventHandler(this, &Form::Form_KeyDown); ... void Form1::Form_KeyDown(Object^ Sender, KeyEventArgs^ E) { MessageBox::Show("Key = " + E->KeyCode.ToString(), "Test"); } The above event handler never fires. But the form's child controls' handler does. What would be the problem ? ...

How to save the value of INPUT in variable?

How to save the value of INPUT in variable to not to write a lot of duplicate code? like var input = $(this).val(); full example <div id="form"> 1. <input type="text" value="title" /> 2. <input type="text" value="value" /> </div> $(function(){ $('#form input:eq(0)').bind({ focus: function(){ if($(this).val()=='ti...

FF and IE - way of handeling \n in textarea

Im doing a textarea with jeditable. The content is saved and loaded from a database. But im having some problems in the way IE and FF handles linebreaks differently. After some debugging i've found a mysterious behavior in FF. For example if i input in textarea: 1 2 It will return 1<br>2 Which is fine. But if i write: 1 2 3 It ...