jquery $(this).css(); is producing Uncaught TypeError: Cannot read property 'defaultView' of undefined : I have a the below code where I would like to check the id of an element. but when i put

            $(this).attr("Id");
it returned "undefined". So I checked with     

        .css("width");
and it returns: Uncaught TypeError: Cannot read property 'defaultView' of undefined.

Below is my code:

<!-- begin snippet: js hide: false console: true babel: false -->

<!-- language: lang-js -->

    function create_login_dialog()
    {
    	$(this).on("click",function(){
    		element_id = $(this).css("width");
    		if(element_id=="#login")
    		{
    			var login_dialog = "<form id='login_dialog' method='post' action=''></form>";
    			$("body").append(login_dialog);
    			console.log("logindialog is working");
    		}
    		else
    		{
    			console.log(element_id);
    		}
    	});


    console.log("loginquery.js is working");
    }

<!-- language: lang-html -->

    <div id="login">the login div</div>

<!-- end snippet -->

Please point me what's wrong with this!