$('input[name="6"][value="update"]').attr("checked", true);
Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts
Sunday, March 6, 2016
Jquery update character from string using index or character at postion
setCharAt: function (str, index, chr) {
if (index > str.length - 1) return str;
return str.substr(0, index) + chr + str.substr(index + 1);
}
if (index > str.length - 1) return str;
return str.substr(0, index) + chr + str.substr(index + 1);
}
Jquery set charater at string
setCharAt: function (str, index, chr) {
if (index > str.length - 1) return str;
return str.substr(0, index) + chr + str.substr(index + 1);
}
if (index > str.length - 1) return str;
return str.substr(0, index) + chr + str.substr(index + 1);
}
Friday, February 26, 2016
How to use Deferreds and Promises in ajax call
//Ajax function
getPromise: function (serviceUrl, folderId, featureId, loginId, sessionId) {
var deferred = $.Deferred();
$.ajax({
type: "POST",
url: serviceUrl + "/test.asmx/getFolderFeaturePrivilegeList",
contentType: "application/json; charset=utf-8",
data: '{"folderId":"' + folderId + '","featureId":"' + featureId + '","loginId":"' + loginId + '","sessionId":"' + sessionId + '"}',
dataType: "json",
success: function (data) {
deferred.resolve(data.d);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Error has occured");
}
});
//setTimeout(function () {
// deferred.resolve("hurray");
//}, 1000);
return deferred.promise();
}
//calling function
download: function (serviceUrl, folderId, featureId, loginId, sessionId) {
alert('download');
$.when(ecabSettings.getPromise(serviceUrl, folderId, featureId, loginId, sessionId)).done(function (value) {
alert('hi');
console.log(value);
});
},
getPromise: function (serviceUrl, folderId, featureId, loginId, sessionId) {
var deferred = $.Deferred();
$.ajax({
type: "POST",
url: serviceUrl + "/test.asmx/getFolderFeaturePrivilegeList",
contentType: "application/json; charset=utf-8",
data: '{"folderId":"' + folderId + '","featureId":"' + featureId + '","loginId":"' + loginId + '","sessionId":"' + sessionId + '"}',
dataType: "json",
success: function (data) {
deferred.resolve(data.d);
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert("Error has occured");
}
});
//setTimeout(function () {
// deferred.resolve("hurray");
//}, 1000);
return deferred.promise();
}
//calling function
download: function (serviceUrl, folderId, featureId, loginId, sessionId) {
alert('download');
$.when(ecabSettings.getPromise(serviceUrl, folderId, featureId, loginId, sessionId)).done(function (value) {
alert('hi');
console.log(value);
});
},
Sunday, February 21, 2016
Jquery get last li text from div or ul tag
var currentFolder = $('#divBreadCrumb li:last-child').text();
Thursday, February 18, 2016
Re-positioning Jquery UI Autocomplete Results Box
http://jsfiddle.net/9QmPr/
Thursday, February 11, 2016
Jquery, line break in textarea.. don't get \n and get ↵
document.getElementById('textareaid').innerHTML;
textString=textString.replace(/<br>/g,"\n");
Jquery remove last comma from string
s = s.substring(0, s.length - 1);
Wednesday, November 25, 2015
Tuesday, November 17, 2015
jquery nested json example
shareNoteDocumentJson.push({
userId: '1',
notes: [
{ noteId: 'n1', note: 'note1' },
{ noteId: 'n2', note: 'note2' },
{ noteId: 'n3', note: 'note3' },
],
documents: [
{ documentId: 'd1', document: 'document1' },
{ documentId: 'd1', document: 'document2' },
{ documentId: 'd1', document: 'document3' },
]
});
userId: '1',
notes: [
{ noteId: 'n1', note: 'note1' },
{ noteId: 'n2', note: 'note2' },
{ noteId: 'n3', note: 'note3' },
],
documents: [
{ documentId: 'd1', document: 'document1' },
{ documentId: 'd1', document: 'document2' },
{ documentId: 'd1', document: 'document3' },
]
});
jquery check if radiobutton is checked
if($('#radio_button').is(':checked')) { alert("it's checked"); }
Monday, November 16, 2015
jquery radio button checked event by name
$('input:radio[name="share"]').change(function () {
alert(this);
});
alert(this);
});
Wednesday, November 11, 2015
jquery datatable remove search filter
$(document).ready(
function
() {
$(
'#example'
).dataTable( {
"bFilter"
:
false
} );
} );
Friday, October 30, 2015
Remove duplicate objects in an array of object in JavaScript
function remove_duplicates(objectsArray) {
var usedObjects = {};
for (var i=objectsArray.length - 1;i>=0;i--) {
var so = JSON.stringify(objectsArray[i]);
if (usedObjects[so]) {
objectsArray.splice(i, 1);
} else {
usedObjects[so] = true;
}
}
return objectsArray;
}
Tuesday, August 18, 2015
Call parent Javascript function from inside an iframe
window.parent.rxTreeSelectNode(folderID);
rxTreeSelectNode - Your Function Name
rxTreeSelectNode - Your Function Name
Iframe set source or href using jquery
var folderID = $(this).closest('[id]').attr('id');
var url = 'UploadMultipleFiles.aspx?folderId=' + folderID;
$('#myframe').attr("src", url);
var url = 'UploadMultipleFiles.aspx?folderId=' + folderID;
$('#myframe').attr("src", url);
Jquery get session value asp.net
var sessionId = '<%=HttpContext.Current.Session["SessionID"]%>';
jquery get Url parameters
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
Tuesday, July 14, 2015
ASP.NET Jquery clear dropdown values
$('#<%=ddlStatus.ClientID%>').val("");
Jquery OR condition
if (hdnWorkflowTaskFlag == 'Edit' || hdnWorkflowTaskFlag == 'Add') {
}
}
Subscribe to:
Posts (Atom)