How To Add A Dropdownlist To Append Tag In Jquery

Here i am enable to add the dropdownlist to append tag of jquery can any one help me in this

here is my code


$(".tasks-add").click(function () {

$('.tasks').append('<li class="elements"><?php echo $form->labelEx($modelAcademics, 'Academic'); ?><?php echo $form->dropDownList($modelAcademics, '[]academics', array('school', 'college'));?></li>');



but i am able to add the textfield instead of dropdownlist can any help me in this

im also trying for sameā€¦ if got solution let me know plzzz

You can not use php code inside JavaScript for appending in html, you can use ajax to get created dropdown html from php file

As pointed out by Absar a PHP code cannot get executed from a client via javascript at runtime. You would need to trigger a call back to server using Ajax (where you can run any PHP code) and send back a response to client to overwrite your html markup.