23 January 2012

Override jQuery.val() and jQuery.val(value)

Hi all,

Sometimes there are cases when you need to do something when $.val() and $.val(value) from jQuery is called,  but then you still want the default behavior to be kept. Here is an example of how you could do that:

Code:
var originalVal = this.originalVal = $.fn.val;
$.fn.val = function(value) {
    if (typeof value == 'undefined') {
        alert('Getting the value');
        return originalVal.call(this);
    }
    else {
        alert('Setting the value');

        return originalVal.call(this, value);
    }
};


I for example have used it for a jQuery widget, I wanted to override the default behavior of the val()  function when this is performed on the element for which a widget was used. So what I have done is I have added a custom attribute to the element for which I am using the widget and then in the val() I am checking the presence of that attribute - just like below:

11 October 2011

Invalid Argument, jQuery bgiframe + position + iframe + IE6

Hi all,

Do you have an error when using jQuery bgiframe library together with jQuery UI position and your own frame? An error like: Invalid Argument. Which is actually very odd.

The problem when putting my own iframe behind a element that I want to position somewhere on the page with jQuery UI position function it throws the error. The error is thrown because jQuery UI position is automatically calling the bgiframe function if it exists. Here is the code:

21 March 2011

jQuery Dialog BUG in IE6 & Quirks Mode

Hi,

I have found a bug in jQuery dialog - it has strange behavior when dragging and resizing a dialog in IE6 or IE7 and up in Quirks Mode.

The problem is that when resizing or dragging many times then the Dialog:
  • Becomes smaller;
  • The content becomes bigger.
I've been trying a lot to try and fix this, I had a walk-through the jQuery UI code and found out these:
On dragging guys from jQuery performs some strange things:
  • Why do they set the height of the Dialog to it's height? "$(this).height($(this).height())". I would not have had anything against it if that piece of code would not set the height of the Dialog with 5px shorter.
    Yes, I'm serious - 5px shorter, however I could not understand how that is possible because it set's the height to the same height.

09 March 2011

window.showModalDialog() - Cross Browser, new version

Hello,

This is a continuation, or a new version for my last post about window.showModalDialog().

The new version was implemented as a jQuery function to which you can pass options which you like.
This version was made because:
    1) The impossibility of previous version to retain dialogArguments during postback;
    2) The impossibility of previous version to close the dialog when the target page is inside several iframe tags;
    3) The impossibility of previous version to retain window.returnValue during postback;
    4) It will be possible now to fire a postback of the page or to fire a postback of a element (with targetElementId) right after the dialog was closed and the callback function finished to execute;
    5) Theoretically this popup library can be used to open another popup inside an existing one (Note: I haven't tried this yet).

However, previous version of my showModalDialog can satisfy someone's requirements and it will be no need to complicate his life with the new version.

XML Parsing and other XML Utilities - Cross Browser

Hello,

Are you searching for an alternative to new ActiveXObject("Microsoft.XMLDOM") which will work in all popular browsers? Then here it is a solution.

This Javascript library will give you the possibility to do almost everything what you could do with ActiveXObject("Microsoft.XMLDOM") but in different browsers.

IE window.showModalDialog() - Cross Browser solution

Hello,

QUESTION: How to make window.showModalDialog() work on cross browser? or at least how to do something similar? with arguments, return value and window.close()?

ANSWER: There is no simple way to do that.

ATTENTION: dialogArguments will be lost if the page inside the popup will do a postback. For a better solution see my new version - click here.

First of all window.showModalDialog() function is something which works only on Internet Explorer and in the best case this command will open a new small window on some browsers, however this window is far from a modal window.

If you still need to have the same functionality as window.showModalDialog(), to pass some parameters / arguments to the page inside the popup and then return some values back from that page in the parent page, and also have the ability to close the popup from the inside of the popup then this article is for you.

Here I have created a modal popup, using jQuery, which gives you the ability to pass arguments to the page inside the popup almost in the same way as you would pass it through showModalDialog().

03 February 2011

Menu on multiple lines - Cross Browser


Hello,

Sometimes the menu which you need to display is generated using a repeater and you do not know exactly how many items will be displayed, and here you need a menu which will wrap in case there is not enough space.

I have also searched for this kind of menu on the internet but I could not find one. This is why I decided to create one by myself.

Well of course some ideas are take from some samples but in general I had to rewrite some code and change CSS, in order to make it to work how I needed and cross browser.

The height of the menu items are automatically readjusted to be the same. This is done because otherwise the menu will not be displayed correctly.

01 January 2010

Do you have any Unsolved Problems on which I could help, Ideas or Suggestions for me? Or you need some consultation in one of these areas?

Do you have any Unsolved Problems on which I could help, Ideas or Suggestions for me? Or you need  some consultation in one of these areas?


Then go ahead and write a comment with the idea or suggestion you have and I will try to answer to your comment as soon as possible.

If you have any unsolved problems in any technologies in which I have experience: C#, ASP.NET, Javascript, CSS, HTML, ASP.NET Dynamic Data, T-SQL, XSLT,.... Then write a comment. ... I will try to help to find a solution.

I can also provide some consulting help if someone needs that.

Let's do life easier for others, in case they have the same problem !!!

Need more? Leave comments and subscribe to my blog.

.