I have write code still cant pass the level - ALPHABETIZE

Alphabetize

raavancraz
4 years ago

0

I tried this code in js bin and it is woring fine but when m trying the code here m still getting the error…can anybody have a look at it

var word = document.getElementById(“words”).value;

var words = word.split(‘, ’);
var words1= words.sort();
var words2 = words1.join(‘, ’);

document.getElementById(“words”).innerHTML = words2;

3replies
2voices
824views
tppt
4 years ago

0

Hey raavancraz,

Your solution seems correct and is really concise compared to mine! Make sure you are storing the result in the right field though and that should do the trick.

Couple of improvments that you could add: use jquery to have access to more powerful feature and also automated the form submit so you don’t waste extra time.

Good luck!

raavancraz
4 years ago

0

Hey tppt ,

i did some modifications in the code but still cant solve the llevel.

i am confused in which textarea we have to store the result .

$(document).ready(function(){
$(“.button–main”).click(function(){
var word = $(‘#words’).val();

var words = word.split(', ');  

var words1= words.sort();  

var words2 = words1.join(', ');  

$("#words").val(words2);  

});
});

tppt
4 years ago

1

Hey, try to put the result in the second textarea (see its html below). Make sure to complete the level below 5 sec!
<textarea name="answer" id="answer"></textarea>

You must be logged in to reply to this discussion. Login
1 of 4

This site only uses cookies that are essential for the functionality of this website. Cookies are not used for tracking or marketing purposes.

By using our site, you acknowledge that you have read and understand our Privacy Policy, and Terms of Service.

Dismiss