- Details
- Written by: Stanko Milosev
- Category: jQuery
- Hits: 3830
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])'
- Details
- Written by: Stanko Milosev
- Category: jQuery
- Hits: 3596
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);
- Details
- Written by: Stanko Milosev
- Category: jQuery
- Hits: 3690
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"; }