10 examples of 'jquery create button' in JavaScript

Every line of 'jquery create button' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
this disclaimer
31function createButton() {
32 var nudge_b = createEl(document.body, "div", "nudge_b");
33 var b_wrapper = createEl(nudge_b, "div", "b_wrapper");
34 var b_container = createEl(b_wrapper, "div", "b_container");
35 var b_message = createEl(b_container, "div", "b_message");
36 b_message.innerHTML = "Show News Feed";
37 $(b_container).on("click", buttonClick);
38}
Important

Use secure code every time

Secure your code as it's written. Use Snyk Code to scan source code in minutes – no build needed – and fix issues immediately. Enable Snyk Code

101function _createButton (options) {
102 var link = L.DomUtil.create('a', options.className || '', options.container);
103 link.href = '#';
104 if (options.text) {
105 link.innerHTML = options.text;
106 }
107 if (options.title) {
108 link.title = options.title;
109 }
110
111 L.DomEvent
112 .on(link, 'click', L.DomEvent.stopPropagation)
113 .on(link, 'mousedown', L.DomEvent.stopPropagation)
114 .on(link, 'dblclick', L.DomEvent.stopPropagation)
115 .on(link, 'click', L.DomEvent.preventDefault)
116 .on(link, 'click', options.callback, options.context);
117
118 return link;
119}
61function newButton(id, label, addToDiv, callback) {
62 var button = new Button({
63 id: id,
64 label: label,
65 type: "button",
66 onClick: callback
67 });
68 if (isString(addToDiv)) {
69 addToDiv = document.getElementById(addToDiv);
70 }
71 if (addToDiv) {
72 button.placeAt(addToDiv);
73 }
74 // TODO: Is startup call really needed here?
75 button.startup();
76 return button;
77}
315function createButtons(cb) {
316 const container = document.createElement('div')
317 container.id = 'region-control-panel'
318 const buttons = document.createElement('div')
319 const confirm = document.createElement('button')
320 confirm.innerText = 'Confirm'
321 confirm.addEventListener('click', () => {
322 hideButtons()
323 removeRegion()
324 const rect = calculateRectFromCoords(coords)
325 cb(
326 `x: ${rect.left}, y: ${rect.top}, width: ${rect.width}, height: ${
327 rect.height
328 }`
329 )
330 })
331 const cancel = document.createElement('button')
332 cancel.innerText = 'Cancel'
333 cancel.addEventListener('click', () => {
334 hideButtons()
335 removeRegion()
336 cb(false)
337 })
338
339 container.style.visibility = 'hidden'
340 buttons.style.display = 'flex'
341 buttons.style.alignItems = 'center'
342 buttons.style.justifyContent = 'center'
343
344 styleButton(confirm)
345 styleButton(cancel)
346
347 buttons.appendChild(cancel)
348 buttons.appendChild(confirm)
349 container.appendChild(buttons)
350 return container
351}
25function createButton(name){
26 var code= "";
27 code+='<table width="100%" border="0" cellpadding="0" cellspacing="0" class="button">';
28 code+=' <tr>';
29 code+=' <TD bgcolor="#475298" vAlign="top" width="9" height="24"><IMG height="24" width="9" alt="" ';
30 code+=' id= "' + name + '_left_img" ';
31 code+=' src="../../images/button_left.gif" border="0">';
32 code+=' </TD>';
33
34
35 code+=' <td bgcolor="#475298" height="24" valign="middle" align="center" class="buttonDisactive" id="' + name + '_txt">';
36 code+=name;
37 code+=' </td>';
38 code+=' <TD bgcolor="#475298"vAlign="top" width="10" height="24"><IMG height="24" width="10" alt="" ';
39 code+=' id= "' + name + '_right_img" ';
40 code+=' src="../../images/button_right.gif" border="0">';
41 code+=' </TD>';
42 code+='</tr></table>';
43 return code;
44}
811function create_btn(c) {
812 var $o = $('<button />').addClass('btn btn-default btn-small');
813 if (c)
814 $o.append(c);
815 return $o;
816}
152function getRealButton(){
153 return $(uploader._button.getInput());
154}
153function createButton(text, clazz, icon, tooltip, checked, id)
154{
155 if (!clazz) {
156 clazz = qx.ui.toolbar.Button;
157 }
158 var button = new clazz(text, icon);
159 if (checked) {
160 button.setChecked(true);
161 }
162
163 if (tooltip) {
164 button.setToolTip( new qx.ui.tooltip.ToolTip(tooltip));
165 }
166
167 button.setId(id);
168 return button;
169}
145function makeButtons() {
146 if (!(navigator.userAgent.indexOf("Firefox/2.") > 0)) {
147 $('.usebutton').button({text:true});
148 } else {
149 // fake it; can't seem to get rid of underline though
150 $('.usebutton').css('border', '1px solid black').css('padding', '1px 4px').css('color', 'black');
151 }
152}
297function button (text, onClick) {
298 var result = document.createElement('a')
299 result.text = text
300 result.href = '#' + text
301 result.addEventListener('click', onClick)
302
303 var statNode = document.createElement('h5')
304 statNode.innerText = 'n:0, t:(---), m:(---)'
305 Object.assign(statNode.style, {
306 'margin': '4px',
307 'display': 'inline'
308 })
309
310 var buttonContainer = document.createElement('div')
311 buttonContainer.appendChild(result)
312 buttonContainer.appendChild(statNode)
313 container.appendChild(buttonContainer)
314
315 return {
316 link: result,
317 text: statNode,
318 container: buttonContainer
319 }
320}

Related snippets