Sunday, May 2, 2021

Add icons to links using jquery

If you want to add icons besides your hyperlinks, jQuery can be used to do it as shown below

1. Define Syles

a.pdf { 
    background: url(images/pdf.png) no-repeat left center;
    padding-left: 20px;
    line-height: 16px; /* used to center the image with text */
}
 
a.txt { 
    background: url(images/txt.png) no-repeat left center;
    padding-left: 20px;
    line-height: 16px;
}

a.email {
    background: url(images/email.png) no-repeat left center;
    padding-left: 20px;
    line-height: 16px;
}

2. Add the style using jQuery DOM ready or pageLoad

$(function() {
 
    $("a[href$='.pdf']").addClass("pdf");
 
    $("a[href$='.doc'], a[href$='.txt'], a[href$='.rft']").addClass("txt");
 
    $("a[href^='mailto:']").addClass("email");
 

});

Cheers,

Samitha

Saturday, April 17, 2021

select all elements of a class, except one element

If we want to do some action on selected list of elements except one element in the list we can use jQuery as shown below.

 $(".parentElement:not(#childId)").actionName();

If you want to skip multiple elements

 $(".parentElement:not(#childId1,#childId2)").actionName();

Or you can use not()

$(".parentElement").not("#childId1").actionName();


Cheers,

Samitha

 

Saturday, March 27, 2021

Could not load file or assembly Operation is not supported. (Exception from HRESULT: 0x80131515)

 When running .Net applications you might encounter the following error

 Could not load file or assembly [assembly_name]Operation is not supported. (Exception from HRESULT: 0x80131515)

This error occurs as a  result of a untrusted downloaded file. Follow these simple steps to overcome the issue.


1. Right click the dll and select properties

2. Click unblock button/check box



Regards,

Samitha

Sunday, March 7, 2021

Export html table using jQuery

If you need to export HTML table data to Excel Table to Excel 2 plugin can be used.

Its pretty simple.  Just add

Include JS

<script type="text/javascript" src="../dist/tableToExcel.js"></script>

javascript

<script type="text/javascript">
  $(function () {
      $("#btnExport").click(function(){
        TableToExcel.convert(document.getElementById("table1"), {
            name: "download.xlsx",
            sheet: {
            name: "Sheet1"
            }
          });
        });
  });
</script>
 
Add html Button

<button id="btnExport">Export To Excel</button><br><br>
 
Regards
Samitha

Sunday, February 21, 2021

HTTP Error 500.52 - URL Rewrite Module Error

 When browsing website through IIS you might encounter the following error.

Website is not accessible: HTTP Error 500.52 - URL Rewrite Module Error 

Follow the below steps to resolve this issue.

  • open (IIS) Manager (in windows 10 type "inetmgr" in search windows
  • Navigate to Server name > Sites >your_website > URL rewrite
  • Select each rewrite rule and disable them (Right click  and disable)
  • Enable each rewrite rule (right click and clicking enable)

Cheers

Samitha


Tuesday, February 16, 2021

using carriage return in a HTML tooltip

 If you want to add a line break to HTML tooltip, just press ENTER at the end of each word. Ans example is shown.


<a href="#" title='This

tooltip

shows in

multiple

Lines'>link</a>

Saturday, January 30, 2021

Reset Linkedin link preview cache

 If you have shared your website or an article in LinkedIn and then you decided to change the link preview data then you will see that LinkedIn still displaying old content. This happens as e LinkedIn caches link preview data  for 7 days.

We can resolve this using the LinkedIn Post Inspector. Follow these steps to claerLinkedin link preview cache.

  1. Navigate tohttps://www.linkedin.com/post-inspector/
  2. Input your URL and click on Inspect. preview image will be updated
  3. Retry to share your URL on LinkedIn


 Cheers

Samitha