We help IT Professionals succeed at work.
Get Started

jquery prototype conflict -convert the prototype to jquery

jiritsu
jiritsu asked
on
897 Views
Last Modified: 2012-05-09
I am having a conflict and cannot get it resolved and I have tried just about everything.  Now I would like to convert the prototype to jquery synatx.  Any help converting or fixing my current issue is appreciated.
<head>
<link rel="stylesheet" href="css/styleit.css" type="text/css">
<link href="css/default.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="css/jquery-ui-1.7.2.custom.css">
<script type="text/javascript" src="js/jquery-1.3.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.7.2.custom.min.js"></script>
<script type="text/javascript">

var $j=jQuery.noConflict();

	 $j(document).ready(function(){
	
 	 $j("a").click(function(event){
         alert("As you can see, the link no longer took you to jquery.com");
         event.preventDefault();
       });

		$j('#startdte').datepicker({
			changeMonth: true,
			changeYear: true,
			
		});
		$j('#enddte').datepicker({
			changeMonth: true,
			changeYear: true
		});
	});
	</script>
<script type="text/javascript" src="js/prototype.js"></script>	

<script type="text/javascript">

function handleCount(ev)
	{
	// Determine the root of the input tag's ID that generated the onChange event call.
	var elID = ev.findElement('input[type="text"]').id.substr(0, 3);

	// Find the counter.
	var elCount = $(elID + 'count');

	// Increment the value of the associated change counter.
	elCount.setValue(1 + parseInt(elCount.getValue(), 10));

	// Display the count.
	$(elID + 'show').innerHTML = elCount.getValue();
	}
function handleCount2(ev)
	{
	// Determine the root of the input tag's ID that generated the onChange event call.
	var elID = ev.findElement('input[type="radio"]').id.substr(0, 3);

	// Find the counter.
	var elCount = $(elID + 'count');

	// Increment the value of the associated change counter.
	elCount.setValue(1 + parseInt(elCount.getValue(), 10));

	// Display the count.
	$(elID + 'show').innerHTML = elCount.getValue();
	}
	
	

	
 wait until the dom is fully loaded before trying to access it.
document.observe('dom:loaded', function()
	{
	// add the onchange handler to the input elements
	$$('input[type="text"]').invoke('observe', 'change', handlecount);
	$$('input[type="radio"]').invoke('observe', 'change', handlecount2);
	});
	

</script>

Open in new window

Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 7 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE