Jump to content

bootstrap button shortcode - how to add javascript to the link=""?

Recommended Posts

atblue    0

Hi. So, according to http://demo.pagelines.me/tools/ to add standard bootstrap style button easily to my site, I'd do the following:

[pl_button type="success" size="large" link="http://google.com" target="blank"]Launch Tour[/pl_button]

That basic scenario works well enough, but what I'd really like this newly created button to do is something more complex. I'd like it to act just like this regular text link I've created:

<a onclick="PopupCenter('http://exampletourli...om/example.html' 'tour',1300,830);" href="javascript:void(0);">temp launch tour link</a>

The question is how do I get the onclick info into the bootstrap button shortcode? Will the javascript:void(0) portion work as the replacement link="xxx"?

Thank you,


Share this post

Link to post
Share on other sites
Rob    547


I'm not convinced you can add javascript like that within a shortcode.

What's the purpose of this onclick action? What function does it perform?

Former PageLines Moderator, Food Expert and Raconteur

Share this post

Link to post
Share on other sites
atblue    0

Hi Rob, sorry for the late reply! I need to understand better how to follow these topics (got it now) .. as I thought I was receiving updates on replies, but evidently not.

To answer your question, the purpose of the onclick action is to call some javascript code that I've pasted into the Headerscripts Code that essentially says "open a new window at these sizes and at this location on the screen" so as to display our virtual tours from the portfolio (and portfolio detail) pages. The code I pasted is this:


function PopupCenter(pageURL, title,w,h) {

var left = (screen.width/2)-(w/2);

var top = (screen.height/4)-(h/4);

var targetWin = window.open (pageURL, title, 'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);



We have dozens of tours and some of them open at different sizes to be ideal, and so I wanted that control. Doing this from a text link is no problem, but of course the buttons look much better, so I was hoping to do it within the PL templates. Ultimately I will hand this off to my client, to edit and implement new/future tours, so I was hoping that there was a way I could teach him without having to dig into too much code.

Perhaps there is another way?

Many thanks again,


Share this post

Link to post
Share on other sites
Danny    1,327


You won't be able to add javascript to the button shortcode. However, you could try using the Bootstrap HTML code for the button and add your javascript that why instead.

Visit the buttons page on Bootstrap for the HTML code - http://twitter.github.com/bootstrap/base-css.html#buttons

Please search our forums, before posting!

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • ppotent
      By ppotent
      Any chance of a pagelines table plug-in coming? I know that the use of short codes and bootstrap can achieve this, but I can't seem to find any easy/visual editor way of doing this. There are table plug-ins around for wordpress, but honestly, they are pretty clunky. I'd pay for a tables plug-in, given how much I would use tables if I could.
    • Samuel Costa - UDF
      By Samuel Costa - UDF+
      I need a shortcode activate a popup windows with contact form. It is possible without code?
      Link: https://www.udf.org.br/lancamentos/curso-mulher-que-prospera/
    • chamois_blanc
      By chamois_blanc+
      I am trying to clone a container on a page. It throws the following javascript error:
      function l(b, c, e, f) { var g = m.a.f.get(b, p); if (!c) { if (g) throw Error("You cannot apply bindings multiple times to the same element."); m.a.f.set(b, p, !0) } I would appreciate guidance and a fix. Thank you
    • Jeremiah
      By Jeremiah+
      Error: editing.js?ver=930684:5 Uncaught TypeError: Cannot read property 'getData' of undefined
      I have all of the plugins disabled and I still receive the error.
      Page Editor will not load on page.
    • Samuel Costa - UDF
      By Samuel Costa - UDF+
      i like to know if i can use signup button shortcode inside text editor or embed section.