php - Set focus to a textbox if user leaves it -


I am currently stumped in a laboratory which I have to complete. I need to create an online site that gets the value of silver coins (using xhmp with localhost), which is part of the laboratory on which I got stuck, I should check to see if someone in a text box The price is when a user leaves it if I do not have to output and alert and set the focus back to that textbox I use Focus on using "this" There can be no way to do this. I should also mention that there are four checkboxes and each text box is related to the related checkbox.

There is a blur function, where I can not get focus on the job. Click (function () {$ ("(": checkbox "). (Function () (if ($ (this) .attr (" checked ")) $ (this). Parent (). Sister (). Children (). Attr ("disabled", false); Focus (); and $ (this) () (): () () () () () (($ ($ ( Click on "(text:") () ($ ("$ btnenter") (function () {if ($ ("(checkbox: check"). Val ()) $ ("form"). (); Other alerts ("no coin type was selected");});});

I suggest you add some IDs or classes to your HTML. So that you can make life easier, this will make the check box differently in your HTML, CSS and JS. Plus it is easy to access the DOM object to a DOM object with an ID or class and the DOM tree is up and up Trying to climb down and completely losing in this process.

Along with this, I suggest similar checkboxes and text boxes, for example:

  checkbox id = "moon If ($ ("# silver1") (i.e. 1) "input type =" text "id =" silver1num "value =" "  

this way

"). Checked & amp; $ ("# Silver1num") Value == "") {

  MsgBox ....... $ ("# silver1num"). Focus (); }   

You can repeat each checkbox again and cut it on some more code. Add a square of "silvercoin" to each checkbox.

  $ (". Silvercoin"). Each (function () {if ($ (this) check and amp; $ ("#" + $ (This) .attr (id) + "number")) .value == "") {messagebox ... ... $ (this) .attr (id) + "number"). Focus (); }}); Note: $ ("#" + $ (this) .attr (id) + "number")) pulls the ID from the checkbox - "Silver 1" and "Number" to give you "# Silver 1number" which is the same input box ID is.  

I have just typed all this code from memory, so I can type incorrect one or two but the concept is same, never less It's been a month or two months played by me

Comments