Tuesday 15 May 2012

javascript - modal appearing when option from select dropdown has been selected -



javascript - modal appearing when option from select dropdown has been selected -

well,

i'm trying create appear modal window if 1 of options in select dropdown selected. did work if instead of using alternative select utilize simple button, need select.

the screen alter it's opacity though, guess i'm doing something.... wrong. have link , scripts bootstrap need, open , close doc , html too.

any suggestions?

thank youuu

html ------------------------------------------------------------------------ <select id="selectaction" data-style="btn-info" onchange="newgraph(this)"> <option value="" disabled selected>select option:</option> <option value="create">create new graph</option> <option value="recall">recall saved graph</option> </select> <!--pop window--> <div data-toggle="modal" data-target="#popup1"> //it works if set in <button> instead div, then, have click button create modal work in not want. <div class="modal hide fade" id="popup1" tabindex="-1" role="dialog" aria-labelledby="popup1" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">close</span></button> <h4>creating new graph:</h4> </div> <div class="modal-body"> <p>here text</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-danger" data-dismiss="modal">close</button> <button type="button" class="btn btn-success">save changes</button> </div> </div> </div> </div> </div> script -------------------------------------------------------------------------------- function newgraph(element) { if($(element).val() === 'create') { $('.toolsheader').show(); $('#popup1').modal(); $('#selectaction').hide(); } else{ homecoming false; }};

remove this: onchange="newgraph(this)" html.

add this:

$('#selectaction').change(function() { newgraph($(this)); });

to js.

javascript html

No comments:

Post a Comment