milosev.com
  • Home
    • List all categories
    • Sitemap
  • Downloads
    • WebSphere
    • Hitachi902
    • Hospital
    • Kryptonite
    • OCR
    • APK
  • About me
    • Gallery
      • Italy2022
      • Côte d'Azur 2024
    • Curriculum vitae
      • Resume
      • Lebenslauf
    • Social networks
      • Facebook
      • Twitter
      • LinkedIn
      • Xing
      • GitHub
      • Google Maps
      • Sports tracker
    • Adventures planning
  1. You are here:  
  2. Home
  3. JavaScript

Checking whether a click event was triggered by physically mouse clicking or not

Details
Written by: Stanko Milosev
Category: jQuery
Published: 29 May 2013
Last Updated: 29 May 2013
Hits: 4022
$('#button').click(function (e) {
    if (e.clientX) {
        // physical click
    } else {
        // program click
    } 
});

From here.

Do not select hidden type

Details
Written by: Stanko Milosev
Category: jQuery
Published: 23 May 2013
Last Updated: 23 May 2013
Hits: 4369

As much as I understood, razor's

@Html.CheckBox("myInputName", false)

Will create HTML like:

<input id="myInputName" name="myInputName" type="checkbox" value="true" checked="checked">

<input name="myInputName" type="hidden" value="false" checked="checked">

If you want with jQuery to select just input which is not hidden, use following code:

$('input[name=myInputName]:not([type=hidden])'

Change form post method

Details
Written by: Stanko Milosev
Category: jQuery
Published: 01 May 2013
Last Updated: 01 May 2013
Hits: 4084

If you have form post method, like:

<form name="myForm" action="/myController/DoSomething?someId=myId" method="post">

and you want myId to change to something else, then you can use this code: 

var myPom = $("form[name=myForm]").attr('action');
myPom = myPom.replace("myId", "123");
$("form[name=myForm]").get(0).setAttribute('action', myPom);

Send a string

Details
Written by: Stanko Milosev
Category: jQuery
Published: 03 April 2013
Last Updated: 03 April 2013
Hits: 4228

One example of jQuery infinite loop, and sending of pure string:

 

function YoThisIsAtest() {
    $.ajax({
        url: 'test/testera',
        type: 'POST',
        data: { latitude: $('#Latitude').val(), longitude: $('#Longitude').val(), culture: $('#Culture').val() },
        datatype: "text"
    }).done(function (msg) {
        if (!bolStop) {
            $('#myResult').html($('#myResult').html() + "
" + msg); YoThisIsAtest(); } }); }

And C§ code should look like:

public string testera(double latitude, double longitude, string culture)
{
  return "Some text";
}
  1. Few tips
  2. Unobtrusive validation
  3. Element select
  4. Global function

Subcategories

Ajax

JavaScript

ExtJS


jQuery

Bing Maps AJAX Control, Version 7.0

Knockout

Jasmine

Moment

node.js

Page 12 of 24

  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16