Jump to content

Recommended Posts

Uhm can you elaborate that?

 

what do you mean with "yes in the dropdown"? do you mean a confirmbox maybe?

 

What do you mean with "it will show an input field" do you mean you want a input field  to be shown inside the form without submitting it?

Link to comment
https://forums.phpfreaks.com/topic/119961-js-event/#findComment-618388
Share on other sites

I'll give you a start

 

<script>
function showInput(){
  //this is where you should build the input or make it visible
}
</script>
<select onchange="showInput()">
  <option>yes</option>
  <option>no</option>
</select>

 

you will still need to write the function but thats part of the fun

Link to comment
https://forums.phpfreaks.com/topic/119961-js-event/#findComment-618489
Share on other sites

yaya....

a more details of Dj:

<script language="JavaScript" type="text/javascript">
function showInput(value) {
    if(value == "yes") {
        var new_input = document.createElement("input");
        new_input.type = "text";
        new_input.name = "txt[]";

        document.getElementById("input-container").appendChild(new_input);
    }
}
</script>

<select onchange="showInput(this.options[this.selectedIndex].value)">
    <option value="yes">Yes</option>
    <option value="no">No</option>
</select>

<div id="input-container">
<!-- This is where your input box held -->
</div>

Link to comment
https://forums.phpfreaks.com/topic/119961-js-event/#findComment-618529
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.