javascript - wordpress custom field content as popup -
I have the stored value in the custom field 'price'. Clickbtn is the square which gives it the size of the button I only clickbtn Trying to read "Click here to reveal price" ... what I am trying to achieve is when the person clicks on the click button popup in which the contents of 'price' Open the www.bookurl.com link in a new tab as well as .
& lt; Div class = "clickbtn" & gt; & Lt; A href = "http://www.bookurl.com" & gt; & Lt ;? Php echo get_field ('price') ;? & Gt; Price & lt; A & gt; Click here to reveal & lt; / Div & gt;
You should use javascript for this, do not have PHP as the tag .
With Simple JS: Simple Way:
& lt; Span id = "price" style = "display: none" & gt; & Lt ;? Php echo get_field ('price');; & Gt; & Lt; / Span & gt; & Lt; An id = "price_ad" href = "http://www.bookurl.com" onclick = "show_price ()" target = "_ blank" & gt; Price & lt; A & gt; Click here to reveal & LT; Script & gt; Function show_price () {document.getElementById ('value'). Style.display = ''; Document.getElementById ('price_ad'). Style.display = 'none'; } & Lt; / Script & gt;
In this way, the click disappears, the price disappears, the price is visible, and the popup opens.
Comments
Post a Comment