我只需要更改标题的第一个值。我做了些什么,但我不知道这是否是最好的方法。
HTML:
<div title="Title that have to be change"> the div is here </div>
JS:
$("div").click(function(){
var title = $(this).attr('title').split(' ')[0];
/*
title is now getting the first value (T
var getImage = document.getElementById("BCimage");
var imgArray = ["images/1.png","images/2.png","images/3.png","images/4.png"];
var countIndex=0;
function img(){
getImage.setAttribute("src", imgArray[countIndex]);
countIndex++;
if(countIndex>=imgAr