In my previous post I have shown how to create an express app with node.js and in this post, I would like to introduce bower a package manager for front-end development. Bower is a package manager just like Nuget, where it gets confusing is that node already has a package manager called npm. The difference […]
I recently had to do work on localeCompare in JavaScript and though I would write a plugin in JQuery and share it. Javascript Locale Compare JavaScript provides a localeCompare function for comparing two strings in the current locale. The locale is based on the language settings of the browser. To explain locale compare lets look […]
Was debugging some code that was broken due to jquery 1.6 update, and found this call for Jquery dropdown.val
1 |
$("#dropDownSelect option[text=" + myText +"]").attr("selected","selected") ; |
Not working anymore but a simple fix of changing it to
1 |
$("#dropDownSelect option[text=" + myText +"]").prop("selected",true) ; |
This does the trick, for more on prop take a look at the api of jquery http://api.jquery.com/prop/
Was coding some new functionality and though I would post this, so that others can find it helpful. Lets say you have a form that has a checkbox that will update the select dropdown box with different values, when the checkbox is clicked. Something like the UI below. Your html code might look like
1 2 3 4 5 6 7 8 |
<input type="hidden" name="fieldId" value="123" /> Parent: <select name="FieldType" id="fieldTypeDropDown"> <option value="16">None</option> <option value="4">Apple</option> <option value="3">Orange</option> </select> Multiple: <input type="checkbox" name="fieldMultiple" id="fieldMultiple" /> |
[…]
So here is an interesting jquery plugin called jqprint it allows one to specify any element and sent it to print. Assuming you have an element with id printButton and a content area called divToPrint
1 2 3 |
$('#printButton').live('click', function() { $('#divToPrint').jqprint(); }); |
This will pop up the print functionality in your browser and send it with the default media=”print” css or […]
So for some reason IE just loves to cache things for you when you call an ajax method, thus my JQuery get ajax call not working in IE. Something like
1 2 3 4 |
$('#mybutton').live('click', function() { $.post('SaveLanguage', { lang : $(this).val(), null, null); $.get('GetLanguage', null, function(html) { $('#myDiv').replaceWith(html); }); }); |
This will work every time in firefox but IE will just call the cache version, thus whatever you have changed in the post version […]
So was having issues as in why does my checkbox doesn’t work in IE when I do
1 2 3 |
$('.checkbox').live('change', function() { alert('Checkbox clicked'); }); |
And found out that jquery does not bind live “change” events, I was told that it works in 1.4.2 but for some reason I still was not able to get it working. The solution that I found […]