Monday, May 20, 2013

Jquery: add readonly to HMTL5 input tag

Use attr method:

$('#inputId').attr('readonly', true);

Reference:
http://stackoverflow.com/questions/1306708/add-readonly-to-input-jquery

Microsoft Visual Studio: Unable to start debugging on the web server

Using Microsoft Visual Studio, when you try to run the solution, ff you get the error:

Microsoft Visual Studio: Unable to start debugging on the web server. The web server did not respond in a timely manner.  This may be because another debugger is already attached to the web server.


Just reset IIS using iisreset in a console opened as administrator:






Thursday, May 16, 2013

IIS7.5: “405 method not allowed” for “PUT” method

If you get the “405 method not allowed” for “PUT” method You have to disable the ISS webdav option:

In Windows 7
1. Click on "start"
2. clieck on "Control panel"
3. click on "Programs"
4. click on "Turn windows features on or off" and wait some seconds
5. Disable the option : "Internet Information Services" > "world wide web services" > "Common HTTP Feature"s > "webDAV publishing"
6. Click "ok"

Reference:
http://social.msdn.microsoft.com/Forums/en-US/windowsazure/thread/a22b9e60-8353-40c7-af3e-69a8f18240c1

Jquery: get selected item value of a dropdown - combobox element in jQuery

Use $('#{Id} :selected')

var selectedItem = $('#dropDownId :selected') // selected item object
var selectedItemText = $('#dropDownId :selected').text(); // selection text
var selectedItemId = $('#dropDownId :selected').attr('id'); // selection id

Reference:
http://stackoverflow.com/questions/2780566/to-get-selected-value-of-a-dropdown-select-element-in-jquery

Tuesday, May 14, 2013

HTML5: select tag placeholder

Use the disabled selected property:


<select>
    <option value="" disabled selected>Select your option</option>
    <option value="hurr">Durr</option>
</select>

Reference:
http://stackoverflow.com/questions/5805059/select-placeholder

Monday, May 13, 2013

JQuery: remove content of div

To remove all the content of a div you can use .empty() function:

$('#mydiv').empty();

Reference:
http://stackoverflow.com/questions/652917/in-jquery-want-to-remove-all-html-inside-of-a-div