10 examples of 'jquery create span' in JavaScript

Every line of 'jquery create span' 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
552function createSpan(cl, str) {
553 return '<span class="' + cl + '">' + str + '</span>';
554}
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

79function span(attrs) {
80 return $("<span/>", attrs);
81}
120function span_id(id) { return empty_id("span",id); }
42function createSpan(classNames, innerHTML, attrs = {}) {
43 return createElement("span", classNames, innerHTML, attrs);
44}
286function findspan(s) {
287 for (let i = 0; i < $("codearea").childNodes.length; i++)
288 if ($("codearea").childNodes[i].tagName === 'SPAN')
289 if ($("codearea").childNodes[i].childNodes[0].data === s)
290 return $("codearea").childNodes[i];
291}
20function createEllipsisSpan(text) {
21 return $('<span>', {
22 title: text,
23 "class": "sw360-ellipsis",
24 }).text(text);
25}
188function getSpanClass(className) {
189 var span = baseSpan.cloneNode(false);
190 span.className = className;
191 return span;
192}
190function divSpanWrap($el, $container, method) {
191 switch (method) {
192 case "after":
193 // Result: <element /> <container />
194 $el.after($container);
195 return $el.next();
196 case "before":
197 // Result: <container /> <element />
198 $el.before($container);
199 return $el.prev();
200 case "wrap":
201 // Result: <container> <element /> </container>
202 $el.wrap($container);
203 return $el.parent();
204 }
205
206 return null;
207}
214function divSpan($el, options, divSpanConfig) {
215 var $div, $span, id;
216
217 if (!divSpanConfig) {
218 divSpanConfig = {};
219 }
220
221 divSpanConfig = $.extend({
222 bind: {},
223 divClass: null,
224 divWrap: "wrap",
225 spanClass: null,
226 spanHtml: null,
227 spanWrap: "wrap"
228 }, divSpanConfig);
229
230 $div = $('<div />');
231 $span = $('<span />');
232
233 // Automatically hide this div/span if the element is hidden.
234 // Do not hide if the element is hidden because a parent is hidden.
235 if (options.autoHide && $el.is(':hidden') && $el.css('display') === 'none') {
236 $div.hide();
237 }
238
239 if (divSpanConfig.divClass) {
240 $div.addClass(divSpanConfig.divClass);
241 }
242
243 if (divSpanConfig.spanClass) {
244 $span.addClass(divSpanConfig.spanClass);
245 }
246
247 id = attrOrProp($el, 'id');
248
249 if (options.useID && id) {
250 attrOrProp($div, 'id', options.idPrefix + '-' + id);
251 }
252
253 if (divSpanConfig.spanHtml) {
254 $span.html(divSpanConfig.spanHtml);
255 }
256
257 $div = divSpanWrap($el, $div, divSpanConfig.divWrap);
258 $span = divSpanWrap($el, $span, divSpanConfig.spanWrap);
259 classUpdateDisabled($div, $el, options);
260 return {
261 div: $div,
262 span: $span
263 };
264}
34getMessageSpan(message) {
35 const messageSpan = document.createElement('span');
36 messageSpan.appendChild(document.createTextNode(message));
37 return messageSpan;
38}

Related snippets