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

Answer Posted / 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       View All Answers


Please Help Members By Posting Answers For Below Questions

What is a callback url?

519


How do you disable javascript?

452


What are the seven data types of javascript?

508


How to read a cookie using javascript?

526


Which keywords are used to handle exceptions?

518






List different ways of empty an array in javascript?

430


How to create an object in javascript?

606


what are the difference unescape() and escape() functions?

549


What is the syntax of ‘self invoking function’? Give an example?

483


How can javascript be used to improve the "look and feel" of a web site? By the same token, how can javascript be used to improve the user interface?

514


What is the difference between the operators ‘==‘ & ‘===‘?

479


Write a way by which you can do something on the close of the window ?

558


How to convert a string to lowercase?

568


Difference between undefined and undeclared variables?

510


Why is my javascript function not defined?

480