Getting an "echoed" button to do something
-
Putting this here as it just gets swamped by plugin questions in the plugs and hacks area.
I am hoping someone can help me with this, I am a C# developer getting into WordPress and I hate PHP so far.
Nothing I try works at all.
I am writing a wordpress admin page, and need to get the values of 2 inputs and put them into a named h3 below it when a button is clicked, but absolutely nothing I try works.
This is my button:
echo “Query: <input type=\”text\” name=\”query\” placeholder=\”URL Query\”>?Replace: <input type=\”text\” name=\”replace\” placeholder=\”Text to Replace\”>?<input type=\”submit\” name=\”generate\” class=\”button button-primary\” value=\”Generate\” onclick=\”generate\”>”;And this is the text I need to replace:
echo “<h3 id=\”code\”>Your shortcode will appear here.</h3>”;This is what I tried (in many different ways over the last hour):
function generate(){
echo “<script type=\”text/javascript\”>
code.innerHTML=\”somecode\”;
</script>”;
}[closed as duplicate – I moved your original topic to the ‘HowTo and Troubleshooting’ sub forum at https://www.ads-software.com/support/topic/getting-an-echoed-button-to-do-something?replies=1 ]
- The topic ‘Getting an "echoed" button to do something’ is closed to new replies.