Archive for the 'JQuery' Category
Jquery: dropdown.val(‘selected’, ‘selected’) does not work anymore.
Monday, July 25th, 2011
Was debugging some code that was broken due to jquery 1.6 update, and found this call. ?View Code JAVASCRIPT1 $("#dropDownSelect option[text=" + myText +"]").attr("selected","selected") ; Not working anymore but a simple fix of changing it to ?View Code JAVASCRIPT1 $("#dropDownSelect option[text=" + myText +"]").prop("selected",true) ; This does the trick, for more on prop take a [...]
ASP MVC, Jquery modifying a select drop down with Json data
Thursday, November 18th, 2010
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 ?View [...]
JQuery print part of div only
Wednesday, May 19th, 2010
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 ?View Code JAVASCRIPT1 2 3 $(’#printButton’).live(’click’, function() { $(’#divToPrint’).jqprint(); }); This will pop up the print functionality in your browser [...]
JQuery get ajax call not working in IE
Wednesday, May 5th, 2010
So for some reason IE just loves to cache things for you when you call an ajax method. Something like ?View Code JAVASCRIPT1 2 3 4 5 $(’#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 [...]
JQuery live ‘change’ doesn’t work in IE
Tuesday, May 4th, 2010
So was having issues as in why does my checkbox doesn’t work in IE when I do ?View Code JAVASCRIPT1 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 [...]
