Browsing articles in "Jquery Tutorial"

Hide Checkbox and Label based on Label text

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

The label text of a checkbox is dynamically generated in CodeCharge. The label text includes the amount of available articles. When this number is (0), the checkbox and the label text should be hidden, if not both checkbox and label value must be shown.

In this case checkbox and label text hidden:

<input id="i_search_2_newdatad9_1" name="d9[]" value="standplaatsreis" type="checkbox"  /><label for="i_search_2_newdatad9_1">Standplaatsreis (0)</label>

in this case checkbox and label visible:

<input id="i_search_2_newdatad9_1" name="d9[]" value="standplaatsreis" type="checkbox"  /><label for="i_search_2_newdatad9_1">Standplaatsreis (8)</label>

how it can be obtained using jquery script. Read more >>

Loop through array of div ids, and refresh those divs every x seconds

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

I have 4 divs:

<div id='blue'></div>
<div id='refresh12'></div>
<div id='red'></div>
<div id='refresh23'></div>

i am putting every div on my page that begins with ‘refresh’ into an array like this:

var divs = $('div[id^="refresh"]');

Now, what I want to do, is refresh the divs in the array every 5 seconds. I know I need to use SetInterval, but I’m not sure how to start the loop. Also, the divs aren’t pulling content from another page, it’s from the same page, just dynamic data that needs to be refresh every 5 seconds. Read more >>

jQuery – why isn’t this simple function working?

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

I’m building a web application and I’ve decided to have a fiddle with jQuery and Javascript – something I’ve never really used before.

I have included jQuery in my header using Google Libraries:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>

And now I’m fiddling with the SIMPLEST of jQuery but it’s not working.

<p><a href="#" id="lovecounter"><?php if ($post->love) { echo $post->love; } else { echo 0; } ?></a></p>

<script type="text/javascript">

$("#lovecounter").click(function() {
  alert("Click");
});         

</script>

I am clicking on the lovecounter link but there is no alert. If I add simple javascript to the actual anchor tag it works though.

<p><a href="#" id="lovecounter" onclick="alert('test')"><?php if ($post->love) { echo $post->love; } else { echo 0; } ?></a></p>

Any ideas? What am I doing wrong? Read more >>

jquery to slide down – up the form- hidden by default for the first time

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

I would like to not display the form until the user click the button but I fail to make it work, it displays by default when the page shows up

Read more >>

Sending input array values by POST to php Using Jquery

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

I am trying to read the values of an input array and pass them to my backend PHP, but am not able to get this working. I have the following html:

<input name='field[]' class='myclass' value='test1'>
<input name='field[]' class='myclass' value='test2'>
<input name='field[]' class='myclass' value='test3'>
<input id='post_this_val' type='button' value='Post'>

I want to read these values in jQuery and POST the values to my backend PHP, which will then process the results. This is what I do:

$('#post_this_val').live('click', function () {
    var inpVal = $('input.myclass').map(function(i, el) {
                            return el.value;
                    });
    $.post('/my/php/function', {data: inpVal});
});

The above POST is not working- my php function is not even getting called and the page simply reloads on clicking the POST button. Suggestions please. Read more >>

jquery checkbox selection

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

If I selecting the check box the corresponding row is selected. I want to change that as Read more >>

How should I check if record exists or not using jQuery Validate Plugin?

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

I just wanted to make a validation rule to check if the record exists in database or not. I also made ajax script like blow & added it using $.validator.addMethod but it is not working. can someone please suggest how to do this ? Read more >>

Confirm password fields via jQuery

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

I am trying to find a small script where while typing in the two password fields and if the passwords do not match then the script will specify… I also hope to do this without having to click the Submit button. Read more >>

How to include php file using Jquery?

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

I have that div and I want to include inside php file using jquery.
Read more >>

jQuery code to validate and stop sending

Mar 13, 2012   //   by phpfreelancer.biz   //   Blog, Jquery Tutorial  //  No Comments

I use this jQuery code to validate a file upload event. It’s successful. But When I click the submit button I don’t want that wrong file to be attached and passed to PHP.
Read more >>

Share This Page

RSS Wordpress News