When generating PDF via PHP using wkhtmltopdf PDf contains garbled squares and characters

I recently installed WKHTMLTOPDF on a Centos 6 Box to generate PDF’s via PHP, after a huge struggle to get WKHTMLTOPDF working, I encountered another problem, whenever trying to generate a PDF via the PHP class that I got from http://code.google.com/p/wkhtmltopdf/wiki/IntegrationWithPhp the PDF generated with funny Square’s funny characters etc. I initially thought this might be an encoding problem, so after another few days, I figured it could be a Font issue. ...

March 22, 2018 · 1 min · 132 words · icarnaghan

Adding inline styles to html element using JQuery

This can be done by using the css JQuery function. Read more An example is $("#myElement").css('border','1px solid #FF0066'); The example above will produce the following <input style="1px solid #FF0066" id="myElement" />

March 21, 2018 · 1 min · 31 words · icarnaghan

Error: "Could not complete the operation due to error c00ce56e" while using Ajax

I recently had a problem trying to load a PHP page into a DIV tag using Ajax. Everything worked fine in Firefox, Opera, Safari and Google Chrome, but there was no way for it to work in Internet Explorer 7. Personally I don’t like Internet Explorer due to amount of problems I get while developing. I tried to load the page into a DIV using JQuery. JQuery failed even thougt it’s supposed to be cross-browser compatible. Then I wrote my own Ajax code and that also didn’t seem to work. As soon as the responseText needs to be called I get the following error in Internet Explorer 7 “Could not complete the operation due to error c00ce56e”. ...

March 21, 2018 · 1 min · 171 words · icarnaghan

How do I hide and show HTML elements using JQuery without any special effects?

This can be done by using the hide() and show() methods or the toggle() method. The toggle() method calls the show() method if the element is hidden and the **hide()**method if the element is showing. $(“selector”).hide(); $(“selector”).show(); or $(“selector”).toggle(); Example: $(function() { $("#mybutton").click(function() { $("#div_id").toggle(); }); }); Basically everytime the button is clicked it hides the div tag. If the div tag is showing it hides it and shows the div tag if the div tag is hidden. The **toggle()**method could also be replaced with $("#div_id").hide(); and $("#div_id").show(); but then the function needs to be changed a bit in order to have it working as above.

March 21, 2018 · 1 min · 106 words · icarnaghan

How do I remove a css class from a div tag and then add another css class to that same div tag using JQuery?

The following code removes a css class and then adds another css class to a specific div tag $('#div_id').removeClass("OldClass").addClass("NewClass"); #div_id = Div Tags ID OldClass = CSS class that needs to be removed NewClass = CSS class that needs to be added

March 21, 2018 · 1 min · 42 words · icarnaghan

How to add a new options to JQuery Chosen Plugin Dynamically

If users is the id of the select Chosen dropdown box, then use JQuery to append new options dynamically as in the example below $("#users").append('<option value="1">User</option>').trigger("chosen:updated"); .trigger(“chosen:updated”); refreshes the Chosen dropdown box with the new option.

March 21, 2018 · 1 min · 36 words · icarnaghan

How to add a new Select Box option after the second option in the Select Box using JQuery

<select id="options"> <option>Option 1</option> <option>Option 2</option> <option>Option 3</option> </select> If you want to add a new option under Option 1, you would need to use the JQuery after function as example below $("#options option:first").after("<option>New second option</option>"); The above will find the first option and then add the second option under the first option withing the select element with id options

March 21, 2018 · 1 min · 60 words · icarnaghan

How to add a preloader when using the JQuery ajax load method

Usually there will be a div tag with an ID in which you will load the content. Example: Now in order to have a preloader displayed while the content is busy loading we need to include the following code within the function used to load the content. function load(){ //This is the function that loads the preloader $(’#load’).html(’’); ...

March 21, 2018 · 1 min · 125 words · icarnaghan

How to change the src (url) of a IFrame using JavaScript

document.getElementById('iframe_id').src = 'newpage.html iframe_id = The ID for the IFrame newpage.html = The page that you want to load into the IFrame

March 21, 2018 · 1 min · 22 words · icarnaghan

How to check and uncheck a html checkbox using JQuery

We will use a checkbox with ID “myCheckbox” in this example First to check a checkbox using JQuery use the following code, remember to replace “myCheckbox” with the ID of your checkbox $('#myCheckbox').attr('checked','checked'); To un-check the checkbox use the following JQuery code, remember to replace “myCheckbox” with the ID of your checkbox $('#myCheckbox').removeAttr('checked');

March 21, 2018 · 1 min · 53 words · icarnaghan