subhash
(Subhash 5c3)
December 4, 2012, 10:56am
1
Here i am enable to add the dropdownlist to append tag of jquery can any one help me in this
here is my code
$(document).ready(function(){
$(".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
iirfan
(Irfan Gokak)
May 2, 2014, 10:19am
2
SUBHASH:
Here i am enable to add the dropdownlist to append tag of jquery can any one help me in this
here is my code
$(document).ready(function(){
$(".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
langy
(Kilo Voltage)
May 4, 2014, 8:03am
4
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.