javascript - How to add Bootstrap Tool tips to a input field when its type=“file” -


i tried following code,

<input type="file" name="file" id="filefield" data-toggle="tooltip" data-placement="bottom"/>  <script>   $(document).ready(function() {     $('[data-toggle="tooltip"]').tooltip();      }); </script> 

after executes this,

<input id="filefield" type="file" data-placement="bottom" data-toggle="tooltip" name="file" data-original-title="" title=""> 

normally add title attribute simple tool tip. in following example simple tool tip without title attribute. , gets updated whenever select different file. need these tool tips bootstrap tool tips , needs updated whenever select different file through "choose file" button. http://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_input_type_file

try

<input type="file" name="file" id="filefield" data-toggle="tooltip" data-placement="bottom" title="no file selected"/>  <script type="text/javascript"> $(document).ready(function(){       $('[data-toggle="tooltip"]').tooltip();  }); </script> 

for changing title:

<script type="text/javascript">    $(function() {         $("filefield").change(function (){           $("filefield").attr("title", "new title text");    }); </script> 

Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -