Can we create buttons in JavaScript ? if yes how? pls provide
sample code... Thanks in advance.....



Can we create buttons in JavaScript ? if yes how? pls provide sample code... Thanks in advance......

Answer / stardev24

We can create in multiple ways.Here I am doing by using jquery

HTML:
<div id="target">
<button id="CreateButton">Create button</button>
</div>

JAVASCRIPT:
$(document).ready(function () {
$("#CreateButton").click(
function () { $('#target').append('<button>button created</button>')
}
);
});

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More JavaScript Interview Questions

How to create a confirmation box?

0 Answers  


why can't we call a static method from a non-static method

0 Answers  


How javascript sort function works?

0 Answers  


How to add html elements dynamically with JavaScript?

0 Answers  


hi iM rahul.my questions is my project is a web based & developed using java,jsp. when i record it using qtp what script i will get like either browser("jdfjkf").page("nkf").... or javawindow("f d ").javaedit("Dasf").... plz clarify my doubt asap and i also need some vbscipt of java coding?

0 Answers  






How do you implement Ajax using hide() function in JQuery?

0 Answers   QuinStreet,


How to create a function using function constructor?

0 Answers  


How to test a string as a literal and as an object ?

0 Answers  


Explain arrow functions?

0 Answers  


How can you declare a class in javascript?

0 Answers  


What is unescape() function?

0 Answers  


What is the difference between .call() and .apply()?

0 Answers  


Categories