Welcome Guest, Not a member yet? Register   Sign In
Jquery with CI
#1

[eluser]uahmed[/eluser]
Hi

I want to play with jquery with CI . I have one page in which i want to hide some div on load . I putt the code of hide but it didnt work . Here is my code

Code:
<html>
<head>
[removed][removed]
[removed]
$(document).ready(function (){

("#test").hide();
("all_name").hide();
//alert("alert");
});

[removed]
</head>

<p> My view has been loaded  </p>
<div id="test">
Here it is
</div>
<select id= "all_name">
&lt;?php foreach ($records as $row) {
?&gt;
<option value="&lt;?php echo $row-&gt;id?&gt;">&lt;?php echo $row->name ?&gt;</option>

&lt;?
}
?&gt;
</select>
&lt;/html&gt;
#2

[eluser]Otemu[/eluser]
Change
Code:
("all_name").hide();
to
Code:
("#all_name").hide();

Also view your console in your browser and see if there any errors coming up, make sure that the path to your JQuery library is correct.
#3

[eluser]InsiteFX[/eluser]
If you want to show javascript tags in your code you need to change the s in the tags to a $.
#4

[eluser]uahmed[/eluser]
[quote author="Otemu" date="1364208251"]
Code:
("#all_name").hide();

Also view your console in your browser and see if there any errors coming up, make sure that the path to your JQuery library is correct.[/quote]

still it didnt work and i am calling jquery from google link

#5

[eluser]TheFuzzy0ne[/eluser]
If you use Firefox, you can install the Firebug addon, which will help you spot any errors and allow you to see any network activity.

It's also wise to [url="validator.w3.org/"]validate[/url] your HTML. You're missing the &lt;body&gt; tags, which probably won't help...
#6

[eluser]uahmed[/eluser]
hi

thanks for the reply , yes i am missing the body tag i was thinking to make it work than making the rest of html . I have firebug installed and shows me no error . Any good toutorial link of using Jquery with CI ?

Thanks
#7

[eluser]TheFuzzy0ne[/eluser]
It doesn't matter which framework you use - JQuery is JQuery, well it is in the context you're using it. It's just manipulating the page. It's not making any AJAX requests.

You'd be better of creating a valid HTML page to start, and then using JQuery to manipulate the page. Would you put a nice new engine into a car that was falling apart and expect the car to run without any problems? The underlying structure can make all the difference.

There are plenty of decent tutorials about: http://lmgtfy.com/?q=jquery+tutorial




Theme © iAndrew 2016 - Forum software by © MyBB