0

Hi . I have question in jQuery

I have div where which will have drop down on change of drop down will change into textbox. onload of the div I want to display the drop-down again .how can I do that

28th Jul 2018, 4:46 PM
Bhavani Sankar
Bhavani Sankar - avatar
3 Respuestas
+ 1
The question is confusing. Would you mind posting the code you have so far to Code Playground and linking it to this thread please?
28th Jul 2018, 11:35 PM
Janning⭐
Janning⭐ - avatar
0
html code: division code: <div class="col-md-6 col-lg-4 col-xs-6 form-group input-group" id="changetype" > <select class="form-control" name="dropdown" id="dropdown" style="width:100%" onchange = "changeSelect()" > <option value="" name="" selected >--subjects--</option> <option value="" name="" >subject1</option> <option value="" name="" >subject1</option> </select> </div> JS code: function changeSelect() { //alert("hi"); var x = document.getElementById("dropdown").value; document.getElementById("changetype").innerHTML = "<input type='text' id='dropdown-textbox-modified' value="+x+" ></input>"; } this will be displayed when click on navbar tab. without refreshing the entire page, if i come back to this tab the textbox should be changed to previous dropdown as in the page load. jquery code for changing i have used is: ; $('#mydiv').find('input:text').each(function() { $('input:text[id=' + $(this).attr('id') + ']').val(''); $('#dropdown').prop('selectedIndex',0); }); how can i do that .
29th Jul 2018, 3:07 AM
Bhavani Sankar
Bhavani Sankar - avatar
0
When you say "without refreshing the entire page, if i come back to this tab" what do you mean? Where did you go that you had to come back from? You can access the Code Playground via the curly braces in the SoloLearn app. Once you get it up there, hopefully we would also be able to tell where you put everything (order and placement matters) and which version of jQuery your code is referencing.
29th Jul 2018, 4:16 AM
Janning⭐
Janning⭐ - avatar