The following test will require mostly JavaScript (including jQuery) and CSS experience. You may complete each with your own suitable solutions and note that each layout should include good styling practices. Questions 2 and 3 should be responsive (pay attention to layout).
Coding standards will also be reviewed so please ensure that the code is written in a clean manner with adequate naming conventions. Be as creative as you'd like, but do not make use of any frameworks, plugins, or libraries, except for jQuery, as we would like to review your core skillsets.
Sample code is provided to start you off in the right direction, however, you may change it completely if you wish to do so as long as you follow the specified guidelines of each question.
You may set up an environment and may choose to either keep each question separate or all on one page. Either way, please label accordingly. At the end, how you excecute and submit the code is completely your decision.
Good luck!
The following rating widget needs to consist of 5 stars. Each star is represented by a span element (which may be changed if needed). Below is the widget's HTML sample code:
<div id='rating'>
<span>*</span>
<span>*</span>
<span>*</span>
<span>*</span>
<span>*</span>
</div>
When a star is clicked, class active should be added to the clicked element and all elements before it. Also, class active should be removed from all elements after it, if there are any. Meaning the user can change the rating accordingly.
For example, after the third span element has been clicked, the HTML code should look like this:
<div id='rating'>
<span class="active">*</span>
<span class="active">*</span>
<span class="active">*</span>
<span>*</span>
<span>*</span>
</div>
Complete the setup function that registers click event handlers and implements the logic of the HTML widget.
For CSS, we require the following:
Lastly, add a solution to clear the active classes if the user decides not to rate the product.
For the form with the id "user-feedback", we want to check the following rules:
If one or more of these rules fail, an appropriate error message should be displayed in the provided div (class "error-message")e.g.
"Name and Lastname are required", "Please enter a valid email" or "A reason is required". You may use any copy for each possible error.
Implement the validateInput function, which returns true when data is valid or false if data is not valid while updating the error message.
function validateInput() {
// Write your code here.
}
validateInput();
console.log($(".error-message").html());
<div class="error-message">
</div>
<form id="user-feedback" onsubmit="return validateInput()">
Firstname and Lastname:
<input type="text" id="fullname" name="fullname" required />
Email:
<input type="text" id="email" name="email" required />
<input type="radio" id="delighted" name="delighted" checked="checked" required />
Delighted
<input type="radio" id="not-delighted" name="delighted" required />
Not delighted
<input type="checkbox" id="donate" name="donate" />
Donate
Reason:
<input type="text" id="reason" name="reason" />
<input type="submit" value="Submit" />
</form>
The layout required is the following (HTML and CSS only):
A client has a web page with a series of tasks. The client has requested a feature where the tasks can be moved up higher or lower based on the user’s priority.
An example of similar HTML would be the following:
<div>
<span>Weekly report</span>
</div>
<div>
<span>Review tickets</span>
<button type="button">↑</button>
<button type="button">↓</button>
</div>
<div>
<span>Prepare presentation</span>
<button type="button">↑</button>
<button type="button">↓</button>
</div>
Implement a function to add the requested functionality. You may create more than one function, however, no JavaScript attribute is allowed on any of the elements. The feature should work with any number of tasks.
The layout required is the following (HTML and CSS only):