Jump to content


Popular Content

Showing content with the highest reputation since 07/19/2019 in all areas

  1. 1 point
    Perhaps you can make use of the get_class() function
  2. 1 point
    You need to learn the difference between arrays and strings. The first is an array of arrays, the second is an array of strings containing numbers and commas Array ( [0] => Array ( [0] => 1 [1] => 5 [2] => 6 [3] => 7 [4] => 8 [5] => 9 ) [1] => Array ( [0] => 2 [1] => 7 [2] => 6 [3] => 5 [4] => 4 [5] => 3 ) [2] => Array ( [0] => 3 [1] => 12 [2] => 13 [3] => 14 [4] => 15 [5] => 16 ) ) Array ( [0] => 1,5,6,7,8,9 [1] => 2,7,6,5,4,3 [2] => 3,12,13,14,15,16 )
  3. 1 point
    @Techbriefers - Brilliant! The way you managed to repeat what Psyco posted 14 hours earlier, removing all structure and readability and fitting the query into a single line, shows sheer genius.
  4. 1 point
    Your problem is that you're adding extra keyup handlers each time a field changes. Look at your code: $(".ui").change(function(){ myResult.keyup(function(e) { //... }); }); That says, every time an element in .ui changes, add a keyup handler to myResult. So on your first pass, as you enter your inputs you're adding a key up handler to every input. On your second pass, you end up adding yet another key up handler to every input so your handler function ends up running twice. On a third pass, you'd add another so your handler runs three times. ... Combine that with your global state variables and you get a mess. When you enter the right value your first handler changes myResult and m to a different input. Then your second handler looks at that new input value and sees that it doesn't match the next sequence value and shows an error. You need to remove the change handler and just add a single keyup (or keypress) handler. Ideally you'd find a way to rely on global state variables less as well.
  5. 1 point
    Either of these functions will do what you want, and without you having to recreate the wheel.
  6. 1 point
    It's not. Here. Yes. Here. Admittedly, I'm asking you to think a little when it comes to some of it, but ... really? Beyond that, Barand has been his typical self and gone above and beyond the call of duty to answer your questions in no uncertain terms and with concrete code examples; yet there are more requests to simply do it for you.
  7. 1 point
    You're looking to avoid inline styles, correct? If so, the following line of code doesn't really change anything: $("input[tabindex = "+ind+"]").css('backgroundColor', clr); You'll still end up with the style attribute attached to each individual input tag. Instead, you could define classes (as suggested by Barand) for your colors. I would name the classes based on whatever each color represents. To apply the class names to the input fields, you could use the .addClass() method. More informaiton can be found here: https://api.jquery.com/addClass/ Basically, you would define a variable like you did for "clr". Maybe the variable would be named something like "clrClass", which would be set to whatever class names you decide to use. So basically, the following lines would be replaced with the new variable and class names: if(ind<3) clr = '#ff11aa'; if(ind>=3 && ind<6) clr = '#aaff11'; if(ind>=6 && ind<=9) clr = '#11aaff'; Then use your tabindex method like the following: $("input[tabindex = "+ind+"]").addClass(clrClass);
  8. 1 point
    Or you could have just said: $cat_name = str_replace('&', 'and ', strtolower($cat_name)); No need to define arrays for this purpose nor to create a second field to hold category name.
  9. 1 point
    from one of your previous threads on this forum - if (IS_LOGGED == false) { header("Location: " . PT_Link('login')); exit(); } or more simply - if (!IS_LOGGED) { header("Location: " . PT_Link('login')); exit(); } this of course assumes that the code producing the IS_LOGGED defined constant is consistently being used and exists before the code you have posted. a feature like controlling who can view a certain page, like the profiles, should be part of the user permission system. does this code have a general purpose user permission system in it?
  10. 1 point
    To be clear: the company you are working for needs you to do something, and rather than do it yourself, you're looking for something you can grab off the internet with a minimum amount of effort on your part?
This leaderboard is set to New York/GMT-04:00
  • Newsletter

    Sign Up
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.