Posts

Showing posts with the label Javascript

Javascript code displayed in white color in visual studio 2017

Visual Studio Formatting Issues / Displayed JavaScript Code With Comment Its also known issue when copy text/code in visual studio showing "formatting selection" popup it will be also solved by below solution Solved: Goto in visual studio ( Options --> Text Editor --> JavaScript / TypeScript --> Language Service )

PDF not open using base64 in chrome

Solved : These options will be help full for resolving the issue. 1- Convert base64 to blob var blob = b64toBlob("JVBERi0xLjcKCjEgMCBvYmogICUgZW50cnkgcG9pbnQKPDwKICAvVHlwZSAvQ2F0YWxvZwog' +   'IC9QYWdlcyAyIDAgUgo+PgplbmRvYmoKCjIgMCBvYmoKPDwKICAvVHlwZSAvUGFnZXMKICAv' +   'TWVkaWFCb3ggWyAwIDAgMjAwIDIwMCBdCiAgL0NvdW50IDEKICAvS2lkcyBbIDMgMCBSIF0K' +   'Pj4KZW5kb2JqCgozIDAgb2JqCjw8CiAgL1R5cGUgL1BhZ2UKICAvUGFyZW50IDIgMCBSCiAg' +   'L1Jlc291cmNlcyA8PAogICAgL0ZvbnQgPDwKICAgICAgL0YxIDQgMCBSIAogICAgPj4KICA+' +   'PgogIC9Db250ZW50cyA1IDAgUgo+PgplbmRvYmoKCjQgMCBvYmoKPDwKICAvVHlwZSAvRm9u' +   'dAogIC9TdWJ0eXBlIC9UeXBlMQogIC9CYXNlRm9udCAvVGltZXMtUm9tYW4KPj4KZW5kb2Jq' +   'Cgo1IDAgb2JqICAlIHBhZ2UgY29udGVudAo8PAogIC9MZW5ndGggNDQKPj4Kc3RyZWFtCkJU' +   'CjcwIDUwIFRECi9GMSAxMiBUZgooSGVsbG8sIHdvcmxkISkgVGoKRVQKZW5kc3RyZWFtCmVu' +   'ZG9iagoKeHJlZgowIDYKMDAwMDAwMDAwMCA2NTUzNSBmIAowMDAwMDAwMDEwIDAwMDAwIG4g' + ...

Bootstrap modal close event using jquery

Solved: $(document.body).on('hidden.bs.modal', '#myModal', function () {             //do something });

add condition in jquery.tmpl.js

Solved: Add condition in tmpl jquery and remember its have closing tag {{if colName==''}}       <a class="hidden" href="${colName}">View</a> {{else}}       <a class="visible" href="${colName}">View</a> {{/if}}

validation city name from regex in javascript

Mostly this pattern used for US cities. It will be accept small and capital character, space, desh and full stop. if (/[^a-zA-Z .,]/.test(txtCity.value)) {           alert('Invalid city name');      } else {           alert('Valid city name');      }

scroll on top using jquery

Solved: $ ( 'html, body' ). animate ({ scrollTop : '0px' }, 300 ); you can set 0 instead of 300 its quickly go on top and you can change selector where you scroll means if you require scroll top to div just change selector and its working

Set span value using jquery and javascript

Solved: Jquery Example: you can set value two different function. 1- text(); 2- html(); $ ( "#submittername" ). text ( "testing" ); $ ( "#submittername" ). html ( "testing <b>1 2 3</b>" ); Difference between text and html functions text - you can set only value html - you can set value with html code but html tags not necessary for set the value JavaScript Example; you can set value from innerHTML document. getElementById ( "spanID" ).innerHTML. ( "testing" );