JQuery Tips

Selectors:
Getting text box value
$(“#TextBoxId”).val();
Chang or set label text
$(“#LabelId”).text(“Your Text”);
Set control CSS “i.e td border width”
$(“#td_id”).css('border-width', '1px');


Animation:
Display DIV element with animation
 $("#div-id").show("slow");
$("#div-id").hide("slow");


Swap Items between two lists
$(“#list1-id :selected”).remove().appendTo(“#list2-id”);

Ajax:
Passing parameters to asp.net web services
var prm1=”value”;
var prm2=2;
$.ajax({
        type: "POST",
        url: "/AjaxWebMethods.aspx/WebMethod ",
        data: '{"parameter1":"' + prm1+ '”,"parameter1":"' + prm2+ '"}',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
            /*your code*/
        },
        error: function(err) { /*your code*/}
    });
Look for data line

Published Thursday, June 04, 2009 9:52 AM by Hisham El-bereky
Filed under: , , ,

Comments

# re: JQuery Tips

Saturday, June 06, 2009 6:44 AM by DigiMortal

One question about animation. I am pretty new to jQuery but I have my blog here. :)

Can I use animation script in my blog with entries where I have more screenshots?

# re: JQuery Tips

Sunday, June 07, 2009 5:14 AM by Hisham El-bereky

I did not do it before in my blog but it's possible by doing some work around,  you can do it from your post html using the flowing steps:

1- Add reference to JQuery library from google APIs at the top line of your post HTML <script type="text/javascript" src="ajax.googleapis.com/.../script>

2- Add another script tag to include your extra jquery animation script  <script type="text/javascript">

function animate(/*todo: your parameters*/)

{

$(“#imageId”).show(“slow”);

//todo: your animation code

}

</script>

3- Add links to show hide images

4- Get screenshots image ID and passing it in your link action

Hopefully working, I’ll try to use animation in my next posts

Leave a Comment

(required) 
(required) 
(optional)
(required)