Link to home
Create AccountLog in
Avatar of Janith Ariyathilake
Janith AriyathilakeFlag for Sri Lanka

asked on

Could you explain above code clearly?

hi,

Could you explain below code clearly?


var li=$('<li>');
    li.append('Custom variable:');
    li.append($('<input>').attr('type','text').addClass('name'));
    li.append('&nbsp;=&nbsp;Value:');
    li.append($('<input>').attr('type','text').addClass('value'));
   $('#variables').append(li);

Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

The code appends two text input elements - one with a class of "name", and the other with a class of "value" - to an <li> element, and then appends that to an element with an id of "variables".

ASKER CERTIFIED SOLUTION
Avatar of Anwar Saiah
Anwar Saiah

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Janith Ariyathilake

ASKER

Could we use "addClass()" function to ad "id" here?
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account