Jump to content


Popular Content

Showing most liked content since 03/13/2018 in all areas

  1. 1 point
    The trouble with input of state you are relying on the user to enter the name correctly, thats why dropdowns are used. <form> <p><label>State of Birth: </label> <select id="state" name="state" onchange="autoFill(this)"> <option value="Queensland">Queensland</option> <option value="Tasmania">Tasmania</option> <option value="Florida">Florida</option> <option value="Victoria">Victoria</option> </select> <p> <label>Country of Birth: </label> <input type="text" id="country" name="country"> </p> </form> <script type="text/javascript"> var stateArray = [[0, 'Queensland'], [0, 'Victoria'], [0, 'Tasmania'], [1, 'Florida']]; var countryArray = ['Australia', 'America']; //0 from above is index to Australia, 1 to USA //Arrays always start from 0 function autoFill(elem) { var countryIndex = ""; for (i = 0; i < stateArray.length; i++) { if (elem.value === stateArray[i][1])//if value from dropdown matches looped thro state array 2nd state values { //store index value to country countryIndex = stateArray[i][0]; document.getElementById('country').value = countryArray[countryIndex]; // use index value to get country array value and show in input break; //stop loop } } } </script>
  2. 1 point
    Instance variables are usually declared as private because OOP considers "encapsulation" to be a good thing. This is the same reasoning behind minimizing the number of global variables. If some variable does not need to be public or global then it shouldn't be. In your example the constructor sets the values of the instance variables, so they themselves don't need to be public.
  3. 1 point
    Seems odd to me that you declare all of the instance variables as public. It is more normal to make them private.
  4. 1 point
    This selector only targets the first direct children element/s of a parent element, not including any hierarchical child element/s of the first direct child element/s within it.
  5. 1 point
    IF you do it correctly $("input[data-class='resultdate'"] Should be $("input[data-class='resultdate']")
  6. 1 point
    It is an attribute, so the usual attribute selector will work.
  7. 1 point
    When you use jQuery and its plugins they often put additional classes on the elements. See if any of the class methods in jQuery help solve your problem, if not then you probably should use data attributes instead of the class attribute to store data. Here's how data attributes are defined: <element data-something="value1" data-somethingelse="value2"> In jQuery you can access the value of data attributes using the data() method: http://api.jquery.com/data/#data-key
  8. 1 point
    I'm not asking you to look at the error console. Look at the network tab. It will have a whole lot of information in it whether or not the request failed. It has the HTTP method, the HTTP status code, the request headers, the request body, the response headers and the response body and it even provides information as to how long the request took to send, process and return from the server. Please show all the information that the network tab provides about the request. I've attached an image showing you what the network tab should look like in your browser:
  9. 1 point
    Try var dataString = { name: name, email: email, location_name: location_name, language_level: language_level, language: language, personal: personal } Had to change location, as it was being treated as a reserved keyword, remember to change $_POST['location'] to $_POST['location_name']
  10. 1 point
    All this can be done with css display: flex. You would have to create code, to loop through the 3 columns, identity which is highest and apply the highest height to all or just the two lower columns. You may want to consider .outerHeight(), as this allows for padding, margins (optional) AND borders.