0

This code is for onclick to get dropdown and changes the text . Everytime on change I want to post the value into database.

index.html

    <div id='fullname'></div>

script.js

    $('#fullname').click(function(){
    var name = $(this).text();
    $(this).html('');
    $('<select>', { 'name': 'fname', 'id': 'txt_fullname'         
   })
    .append($('<option>', 
     {'value':'Hardware_Problem','text':'Hardware_Problem'},'</option>'))
    .append($('<option>', { 'value':'Software_Problem','text':'Software_Problem'},'</option>'))
    .appendTo('#fullname');
    $('#txt_fullname').focus();
});

        $(document).on('blur','#txt_fullname', function(){
            var name = $(this).val();
            $('#fullname').text(name);
        });

0 Answers0