hello everybody.... does anyone know how to implement wordpress like shortcode in html with jquery without php function? for example when i write this code: [accordion]<br /> [item title="Item 1"]Integer eleifend nibh magna, ac fermentum nulla pellentesque non. In nisi est, sollicitudin at mollis sit amet, auctor ut nibh. Fusce ut purus at sapien auctor tempus sit amet nec sapien.[/item]<br /> [item title="Item 2"]Integer eleifend nibh magna, ac fermentum nulla pellentesque non. In nisi est, sollicitudin at mollis sit amet, auctor ut nibh. Fusce ut purus at sapien auctor tempus sit amet nec sapien.[/item]<br /> [item title="Item 3"]Integer eleifend nibh magna, ac fermentum nulla pellentesque non. In nisi est, sollicitudin at mollis sit amet, auctor ut nibh. Fusce ut purus at sapien auctor tempus sit amet nec sapien.[/item]<br /> [/accordion] it will be converted to this code when page loaded: <div class="shortcode sc-accordion" id="accordion-0"> <h5 class="toggle"><a href="#accordion-0" class="active"><span class="arrow">-</span>Item 1</a></h5> <div class="toggle-content" style="display: block;">Integer eleifend nibh magna, ac fermentum nulla pellentesque non. In nisi est, sollicitudin at mollis sit amet, auctor ut nibh. Fusce ut purus at sapien auctor tempus sit amet nec sapien.</div> <h5 class="toggle"><a href="#accordion-0"><span class="arrow">+</span>Item 2</a></h5> <div class="toggle-content" style="">Integer eleifend nibh magna, ac fermentum nulla pellentesque non. In nisi est, sollicitudin at mollis sit amet, auctor ut nibh. Fusce ut purus at sapien auctor tempus sit amet nec sapien.</div> <h5 class="toggle"><a href="#accordion-0"><span class="arrow">+</span>Item 3</a></h5> <div class="toggle-content" style="">Integer eleifend nibh magna, ac fermentum nulla pellentesque non. In nisi est, sollicitudin at mollis sit amet, auctor ut nibh. Fusce ut purus at sapien auctor tempus sit amet nec sapien.</div> </div> see the example in this page: simmerdemo[.]blogspot[.]com/p/accordions-and-toggles.html I think it's just using jquery to convert element, but I am not very expert in jquery... Please help me..
Hands UP I have not seen this type of thing done with HTML/JavaScript only in my 4 years coding experience
nice script brother...but my focus is the shortcode function changing [accordion] to be <div class="shortcode sc-accordion" id="accordion-0">
That's probably because it isn't, and shouldn't ever be. Now that you mention client-side scripting -- that is NOT what it's built for! Even server-side shortcodes are a meaningless, pointless garbage. It can efficiently sweep crappy code under the rug, but that's just about it (if you want an example, look no further). @OP, with all due respect, back the **** away from the keyboard! Thank you ^^